Event recognition

ABSTRACT

An electronic device, while displaying application content for a first application on a touchscreen display, detects an input comprising one or more touches on a region of the touchscreen display that includes the application content of the first application. In response to detecting the input comprising the one or more touches, the electronic device, in accordance with a determination that the one or more touches correspond to a system gesture for switching applications, replaces display of the first application with a second application without delivering information corresponding to the one or more touches to the first application; and in accordance with a determination that the touches do not correspond to a system gesture, delivers the information corresponding to the one or more touches to the first application.

RELATED APPLICATIONS

This application is continuation of U.S. patent application Ser. No.16/898,345, filed Jun. 10, 2020, which is a continuation of U.S. patentapplication Ser. No. 15/339,768, filed Oct. 31, 2016, now U.S. Pat. No.10,719,225, which is a continuation application of U.S. patentapplication Ser. No. 14/043,774, filed Oct. 1, 2013, now U.S. Pat. No.9,483,121, which is a continuation of U.S. patent application Ser. No.13/077,927, filed Mar. 31, 2011, now U.S. Pat. No. 8,566,045, whichclaims priority to U.S. Provisional Application Ser. No. 61/425,222,filed on Dec. 20, 2010, and U.S. application Ser. No. 13/077,927 is acontinuation-in-part of: (A) U.S. patent application Ser. No.12/566,660, filed Sep. 24, 2009, now U.S. Pat. No. 8,285,499, whichclaims priority to U.S. Provisional Application Ser. No. 61/210,332,filed on Mar. 16, 2009; and (B) U.S. patent application Ser. No.12/789,695, filed May 28, 2010, now U.S. Pat. No. 9,684,521, entitled“Gesture Recognizers with Delegates for Controlling and ModifyingGesture Recognition,” which claims priority to U.S. ProvisionalApplication Ser. No. 61/298,531, filed Jan. 26, 2010, entitled “GestureRecognizers with Delegates for Controlling and Modifying GestureRecognition.” All of these applications are incorporated by referenceherein in their entirety.

This application relates to U.S. patent application Ser. No. 13/077,524,filed Mar. 31, 2011, now U.S. Pat. No. 9,244,606, entitled “Device,Method, and Graphical User Interface for Navigation of Concurrently OpenSoftware Applications.” This application is incorporated by referenceherein in its entirety.

This application relates to U.S. patent application Ser. No. 13/077,925,filed Mar. 31, 2011, now U.S. Pat. No. 8,566,044, entitled “EventRecognition,” and U.S. patent application Ser. No. 13/077,931, filedMar. 31, 2011, now U.S. Pat. No. 9,311,112, entitled “EventRecognition.” Both of these applications are incorporated by referenceherein in their entirety.

TECHNICAL FIELD

This relates generally to user interface processing, including but notlimited to, apparatuses and methods for recognizing touch inputs.

BACKGROUND

An electronic device typically includes a user interface that is used tointeract with the computing device. The user interface may include adisplay and/or input devices such as a keyboard, mice, andtouch-sensitive surfaces for interacting with various aspects of theuser interface. In some devices with a touch-sensitive surface as aninput device, a first set of touch-based gestures (e.g., two or more of:tap, double tap, horizontal swipe, vertical swipe, pinch, depinch, twofinger swipe) are recognized as proper inputs in a particular context(e.g., in a particular mode of a first application), and other,different sets of touch-based gestures are recognized as proper inputsin other contexts (e.g., different applications and/or different modesor contexts within the first application). As a result, the software andlogic required for recognizing and responding to touch-based gesturescan become complex, and can require revision each time an application isupdated or a new application is added to the computing device. These andsimilar issues may arise in user interfaces that utilize input sourcesother than touch-based gestures.

Thus, it would be desirable to have a comprehensive framework ormechanism for recognizing touch-based gestures and events, as well asgestures and events from other input sources, that is easily adaptableto virtually all contexts or modes of all application programs on acomputing device, and that requires little or no revision when anapplication is updated or a new application is added to the computingdevice.

SUMMARY

To address the aforementioned drawbacks, some embodiments provide amethod performed at an electronic device with a touch-sensitive display.The electronic device is configured to execute at least a first softwareapplication and a second software application. The first softwareapplication includes a first set of one or more gesture recognizers, andthe second software application includes one or more views and a secondset of one or more gesture recognizers. Respective gesture recognizershave corresponding gesture handlers. The method includes displaying atleast a subset of the one or more views of the second softwareapplication, and while displaying at least the subset of the one or moreviews of the second software application, detecting a sequence of touchinputs on the touch-sensitive display. The sequence of touch inputsincludes a first portion of one or more touch inputs and a secondportion of one or more touch inputs subsequent to the first portion. Themethod also includes, during a first phase of detecting the sequence oftouch inputs, delivering the first portion of one or more touch inputsto the first software application and the second software application,identifying from gesture recognizers in the first set one or morematching gesture recognizers that recognize the first portion of one ormore touch inputs, and processing the first portion of one or more touchinputs with one or more gesture handlers corresponding to the one ormore matching gesture recognizers.

In accordance with some embodiments, a method is performed at anelectronic device with a touch-sensitive display. The electronic deviceis configured to execute at least a first software application and asecond software application. The first software application includes afirst set of one or more gesture recognizers, and the second softwareapplication includes one or more views and a second set of one or moregesture recognizers. Respective gesture recognizers have correspondinggesture handlers. The method includes displaying a first set of one ormore views. The first set of one or more views includes at least asubset of the one or more views of the second software application. Themethod also includes, while displaying the first set of the one or moreviews, detecting a sequence of touch inputs on the touch-sensitivedisplay. The sequence of touch inputs includes a first portion of one ormore touch inputs and a second portion of one or more touch inputssubsequent to the first portion. The method includes determining whetherat least one gesture recognizer in the first set of one or more gesturerecognizers recognizes the first portion of one or more touch inputs.The method also includes, in accordance with a determination that atleast one gesture recognizer in the first set of one or more gesturerecognizers recognizes the first portion of one or more touch inputs,delivering the sequence of touch inputs to the first softwareapplication without delivering the sequence of touch inputs to thesecond software application, and determining whether at least onegesture recognizer in the first set of one or more gesture recognizersrecognizes the sequence of touch inputs. The method furthermoreincludes, in accordance with a determination that at least one gesturerecognizer in the first set of one or more gesture recognizersrecognizes the sequence of touch inputs, processing the sequence oftouch inputs with the at least one gesture recognizer in the first setof one or more gesture recognizers that recognizes the sequence of touchinputs. The method also includes, in accordance with a determinationthat no gesture recognizer in the first set of one or more gesturerecognizers recognizes the first portion of one or more touch inputs,delivering the sequence of touch inputs to the second softwareapplication, and determining whether at least one gesture recognizer inthe second set of one or more gesture recognizers recognizes thesequence of touch inputs. The method furthermore includes, in accordancewith a determination that at least one gesture recognizer in the secondset of one or more gesture recognizers recognizes the sequence of touchinputs, processing the sequence of touch inputs with the at least onegesture recognizer in the second set of one or more gesture recognizersthat recognizes the sequence of touch inputs.

In accordance with some embodiments, a method is performed at anelectronic device with an internal state. The electronic device isconfigured to execute software that includes a view hierarchy with aplurality of views. The method includes displaying one or more views ofthe view hierarchy, and executing one or more software elements. Eachsoftware element is associated with a particular view, and eachparticular view includes one or more event recognizers. Each eventrecognizer has one or more event definitions based on one or moresub-events, and an event handler, which specifies an action for atarget, and is configured to send the action to the target in responseto the event recognizer detecting an event corresponding to a particularevent definition of the one or more event definitions. The method alsoincludes detecting a sequence of one or more sub-events, and identifyingone of the views of the view hierarchy as a hit view. The hit viewestablishes which views in the view hierarchy are actively involvedviews. The method furthermore includes delivering a respective sub-eventto event recognizers for each actively involved view within the viewhierarchy. At least one event recognizer for actively involved views inthe view hierarchy has a plurality of event definitions, and one in theplurality of event definitions is selected in accordance with theinternal state of the electronic device. The at least one eventrecognizer processes the respective sub-event prior to processing a nextsub-event in the sequence of sub-events in accordance with the selectedevent definition.

In accordance with some embodiments, a non-transitory computer readablestorage medium stores one or more programs for execution by one of moreprocessors of an electronic device. The one or more programs include oneor more instructions, which when executed by the electronic device,cause the device to perform any of the methods described above.

In accordance with some embodiments, an electronic device with atouch-sensitive display includes one or more processors, and memorystoring one or more programs for execution by the one or moreprocessors. The one or more programs include instructions forimplementing any of the methods described above.

In accordance with some embodiments, an electronic device with atouch-sensitive display includes means for implementing any of themethods described above.

In accordance with some embodiments, an information processing apparatusin a multifunction device with a touch-sensitive display includes meansfor implementing any of the methods described above.

In accordance with some embodiments, an electronic device includes atouch-sensitive display unit configured to receive touch inputs, and aprocessing unit coupled to the touch-sensitive display unit. Theprocessing unit is configured to execute at least a first softwareapplication and a second software application. The first softwareapplication includes a first set of one or more gesture recognizers, andthe second software application includes one or more views and a secondset of one or more gesture recognizers. Respective gesture recognizershave corresponding gesture handlers. The processing unit is configuredto: enable display of at least a subset of the one or more views of thesecond software application; and while displaying at least the subset ofthe one or more views of the second software application, detect asequence of touch inputs on the touch-sensitive display unit. Thesequence of touch inputs includes a first portion of one or more touchinputs and a second portion of one or more touch inputs subsequent tothe first portion. The processing unit is configured to, during a firstphase of detecting the sequence of touch inputs: deliver the firstportion of one or more touch inputs to the first software applicationand the second software application; identify from gesture recognizersin the first set one or more matching gesture recognizers that recognizethe first portion of one or more touch inputs; and process the firstportion of one or more touch inputs with one or more gesture handlerscorresponding to the one or more matching gesture recognizers.

In accordance with some embodiments, an electronic device includes atouch-sensitive display unit configured to receive touch inputs, and aprocessing unit coupled to the touch-sensitive display unit. Theprocessing unit is configured to execute at least a first softwareapplication and a second software application. The first softwareapplication includes a first set of one or more gesture recognizers, andthe second software application includes one or more views and a secondset of one or more gesture recognizers. Respective gesture recognizershave corresponding gesture handlers. The processing unit is configuredto enable display of a first set of one or more views. The first set ofone or more views includes at least a subset of the one or more views ofthe second software application. The processing unit is configured to,while displaying the first set of the one or more views: detect asequence of touch inputs on the touch-sensitive display unit (thesequence of touch inputs includes a first portion of one or more touchinputs and a second portion of one or more touch inputs subsequent tothe first portion); and determine whether at least one gesturerecognizer in the first set of one or more gesture recognizersrecognizes the first portion of one or more touch inputs. The processingunit is configured to, in accordance with a determination that at leastone gesture recognizer in the first set of one or more gesturerecognizers recognizes the first portion of one or more touch inputs:deliver the sequence of touch inputs to the first software applicationwithout delivering the sequence of touch inputs to the second softwareapplication; and determine whether at least one gesture recognizer inthe first set of one or more gesture recognizers recognizes the sequenceof touch inputs. The processing unit is configured to, in accordancewith a determination that at least one gesture recognizer in the firstset of one or more gesture recognizers recognizes the sequence of touchinputs, process the sequence of touch inputs with the at least onegesture recognizer in the first set of one or more gesture recognizersthat recognizes the sequence of touch inputs. The processing unit isconfigured to, in accordance with a determination that no gesturerecognizer in the first set of one or more gesture recognizersrecognizes the first portion of one or more touch inputs: deliver thesequence of touch inputs to the second software application; determinewhether at least one gesture recognizer in the second set of one or moregesture recognizers recognizes the sequence of touch inputs; and inaccordance with a determination that at least one gesture recognizer inthe second set of one or more gesture recognizers recognizes thesequence of touch inputs, process the sequence of touch inputs with theat least one gesture recognizer in the second set of one or more gesturerecognizers that recognizes the sequence of touch inputs.

In accordance with some embodiments, an electronic device includes: adisplay unit configured to display one or more views; a memory unitconfigured to store an internal state; and a processing unit coupled tothe display unit and the memory unit. The processing unit is configuredto: execute software that includes a view hierarchy with a plurality ofviews; enable display of one or more views of the view hierarchy; andexecute one or more software elements. Each software element isassociated with a particular view, and each particular view includes oneor more event recognizers. Each event recognizer has: one or more eventdefinitions based on one or more sub-events, and an event handler. Theevent handler specifies an action for a target, and is configured tosend the action to the target in response to the event recognizerdetecting an event corresponding to a particular event definition of theone or more event definitions. The processing unit is configured to:detect a sequence of one or more sub-events; and identify one of theviews of the view hierarchy as a hit view. The hit view establisheswhich views in the view hierarchy are actively involved views. Theprocessing unit is configured to deliver a respective sub-event to eventrecognizers for each actively involved view within the view hierarchy.At least one event recognizer for actively involved views in the viewhierarchy has a plurality of event definitions, one of which is selectedin accordance with the internal state of the electronic device, and theat least one event recognizer processes the respective sub-event priorto processing a next sub-event in the sequence of sub-events inaccordance with the selected event definition.

BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1A-1C are block diagrams illustrating electronic devices inaccordance with some embodiments.

FIG. 2 is a diagram of an input/output processing stack of an exemplaryelectronic device in accordance with some embodiments.

FIG. 3A illustrates an exemplary view hierarchy in accordance with someembodiments.

FIGS. 3B and 3C are block diagrams illustrating exemplary eventrecognizer methods and data structures in accordance with someembodiments.

FIG. 3D is a block diagram illustrating exemplary components for eventhandling in accordance with some embodiments.

FIG. 3E is a block diagram illustrating exemplary classes and instancesof gesture recognizers in accordance with some embodiments.

FIG. 3F is a block diagram illustrating the flow of event information inaccordance with some embodiments.

FIGS. 4A and 4B are flow charts illustrating exemplary state machines inaccordance with some embodiments.

FIG. 4C illustrates the exemplary state machines of FIGS. 4A and 4B toan exemplary set of sub-events in accordance with some embodiments.

FIGS. 5A-5C illustrate exemplary sub-event sequences with exemplaryevent recognizer state machines in accordance with some embodiments.

FIGS. 6A and 6B are event recognition method flow diagrams in accordancewith some embodiments.

FIGS. 7A-7S illustrate exemplary user interfaces and user inputsrecognized by event recognizers for navigating through concurrently openapplications in accordance with some embodiments.

FIGS. 8A and 8B are flow diagrams illustrating an event recognitionmethod in accordance with some embodiments.

FIGS. 9A-9C are flow diagrams illustrating an event recognition methodin accordance with some embodiments.

FIGS. 10A-10B are flow diagrams illustrating an event recognition methodin accordance with some embodiments.

FIG. 11 is a functional block diagram of an electronic device inaccordance with some embodiments.

FIG. 12 is a functional block diagram of an electronic device inaccordance with some embodiments.

FIG. 13 is a functional block diagram of an electronic device inaccordance with some embodiments.

Like reference numerals refer to corresponding parts throughout thedrawings.

DESCRIPTION OF EMBODIMENTS

Electronic devices with small screens (e.g., smart phones and tablets)typically display a single application at a time, even though multipleapplications may be running on the device. Many of these devices havetouch-sensitive displays configured to receive gesture as touch inputs.With such devices, a user may want to perform operations that areprovided by a hidden application (e.g., an application that is runningin the background and is not currently displayed on the display of theelectronic device, such as an application launcher software applicationrunning in the background). Existing methods for performing operationsprovided by a hidden application typically require first displaying thehidden application and then providing touch inputs to the now displayedapplication. Therefore, the existing methods require additional steps.Furthermore, the user may not want to see the hidden application, butyet still want to perform an operation provided by the hiddenapplication. In the embodiments described below, improved methods forinteracting with a hidden application is achieved by delivering touchinputs to the hidden application, and processing the touch inputs withthe hidden application without displaying the hidden application. Thus,these methods streamline the interaction with a hidden application,thereby eliminating the need for extra, separate steps to display thehidden application, while providing the ability to control and interactwith the hidden application based on a gesture input.

In addition, in some embodiments, such electronic devices have at leastone gesture recognizer with a plurality of gesture definitions. Thishelps the gesture recognizer work in different distinct operating modes.For example, a device may have a normal operating mode and anaccessibility operating mode (e.g., for people with limited vision). Inthe normal operating mode, a next application gesture is used to movebetween applications, and the next application gesture is defined as athree-finger left-swipe gesture. In the accessibility operating mode,the three-finger left-swipe gesture is used to perform a differentfunction. Thus, a gesture different from the three-finger left-swipe isneeded in the accessibility operating mode to correspond to the nextapplication gesture (e.g., a four-finger left-swipe gesture in theaccessibility operating mode). By having multiple gesture definitionsassociated with the next application gesture, the device can select oneof the gesture definitions for the next application gesture, dependingon the current operating mode. This provides flexibility in using thegesture recognizer in different operating modes. In some embodiments, aplurality of gesture recognizers with multiple gesture definitions isadjusted depending on the operating mode (e.g., gestures performed withthree fingers in the normal operating mode are performed with fourfingers in the accessibility operating mode).

Below, FIGS. 1A-1C and 2 provide a description of exemplary devices.FIGS. 3A-3F describe components for event handling and the operation(e.g., flow of event information) of such components. FIGS. 4A-4C and5A-5C describe operations of event recognizers in more detail. FIGS.6A-6B are flow diagrams illustrating event recognition methods. FIGS.7A-7S are exemplary user interfaces illustrating operations using eventrecognition methods in FIGS. 8A-8B, 9A-9C, and 10 . FIGS. 8A-8B are flowdiagrams illustrating an event recognition method of processing theevent information with a gesture handler of a hidden open application.FIGS. 9A-9C are flow diagrams illustrating an event recognition methodof conditionally processing the event information with a gesturerecognizer of a hidden open application or a displayed application. FIG.10 is a flow diagram illustrating an event recognition method ofselecting an event definition of a plurality of event definitions for asingle event recognizer.

Reference will now be made in detail to embodiments, examples of whichare illustrated in the accompanying drawings. In the following detaileddescription, numerous specific details are set forth in order to providea thorough understanding of the present invention. However, it will beapparent to one of ordinary skill in the art that the present inventionmay be practiced without these specific details. In other instances,well-known methods, procedures, components, circuits, and networks havenot been described in detail so as not to unnecessarily obscure aspectsof the embodiments.

It will also be understood that, although the terms first, second, etc.may be used herein to describe various elements, these elements shouldnot be limited by these terms. These terms are only used to distinguishone element from another. For example, a first contact could be termed asecond contact, and, similarly, a second contact could be termed a firstcontact, without departing from the scope of the present invention. Thefirst contact and the second contact are both contacts, but they are notthe same contact.

The terminology used in the description of the invention herein is forthe purpose of describing particular embodiments only and is notintended to be limiting of the invention. As used in the description ofthe invention and the appended claims, the singular forms “a”, “an” and“the” are intended to include the plural forms as well, unless thecontext clearly indicates otherwise. It will also be understood that theterm “and/or” as used herein refers to and encompasses any and allpossible combinations of one or more of the associated listed items. Itwill be further understood that the terms “comprises” and/or“comprising,” when used in this specification, specify the presence ofstated features, integers, steps, operations, elements, and/orcomponents, but do not preclude the presence or addition of one or moreother features, integers, steps, operations, elements, components,and/or groups thereof.

As used herein, the term “if” may be construed to mean “when” or “upon”or “in response to determining” or “in response to detecting,” dependingon the context. Similarly, the phrase “if it is determined” or “if [astated condition or event] is detected” may be construed to mean “upondetermining” or “in response to determining” or “upon detecting (thestated condition or event)” or “in response to detecting (the statedcondition or event),” depending on the context.

As used herein, the term “event” refers to an input detected by one ormore sensors of the device. In particular, the term “event” includes atouch on a touch-sensitive surface. An event comprises one or moresub-events. Sub-events typically refer to changes to an event (e.g., atouch-down, touch-move, and lift-off of the touch can be sub-events).Sub-events in the sequence of one or more sub-events can include manyforms, including without limitation, key presses, key press holds, keypress releases, button presses, button press holds, button pressreleases, joystick movements, mouse movements, mouse button presses,mouse button releases, pen stylus touches, pen stylus movements, penstylus releases, oral instructions, detected eye movements, biometricinputs, and detected physiological changes in a user, among others.Since an event may comprise a single sub-event (e.g., a short lateralmotion of the device), the term “sub-event” as used herein also refersto an event.

As used herein, the terms “event recognizer” and “gesture recognizer”are used interchangeably to refer to a recognizer that can recognize agesture or other events (e.g., motion of the device). As used herein,the terms “event handler” and “gesture handler” are used interchangeablyto refer to a handler that performs a predefined set of operations(e.g., updating data, updating object(s), and/or updating display) inresponse to recognition of an event/sub-event or a gesture.

As noted above, in some devices with a touch-sensitive surface as aninput device, a first set of touch-based gestures (e.g., two or more of:tap, double tap, horizontal swipe, vertical swipe) are recognized asproper inputs in a particular context (e.g., in a particular mode of afirst application), and other, different sets of touch-based gesturesare recognized as proper inputs in other contexts (e.g., differentapplications and/or different modes or contexts within the firstapplication). As a result, the software and logic required forrecognizing and responding to touch-based gestures can become complex,and can require revision each time an application is updated or a newapplication is added to the computing device. Embodiments describedherein address these problems by providing a comprehensive framework forhandling events and/or gesture inputs.

In the embodiments described below, touch-based gestures are events.Upon recognition of a predefined event, e.g., an event that correspondsto a proper input in the current context of an application, informationconcerning the event is delivered to the application. Furthermore, eachrespective event is defined as a sequence of sub-events. In devices thathave a multi-touch display device (often herein called “screens”) orother multi-touch sensitive surface, and that accept multi-touch-basedgestures, the sub-events that define a multi-touched based event mayinclude multi-touch sub-events (requiring two or more fingers to besimultaneously in contact with the device's touch-sensitive surface).For example, in a device having a multi-touch sensitive display, arespective multi-touch sequence of sub-events may begin when a user'sfinger first touches the screen. Additional sub-events may occur whenone or more additional fingers subsequently or concurrently touch thescreen, and yet other sub-events may occur when all of the fingerstouching the screen move across the screen. The sequence ends when thelast of the user's fingers is lifted from the screen.

When using touch-based gestures to control an application running in adevice having a touch-sensitive surface, touches have both temporal andspatial aspects. The temporal aspect, called a phase, indicates when atouch has just begun, whether it is moving or stationary, and when itends—that is, when the finger is lifted from the screen. A spatialaspect of a touch is the set of views or user interface windows in whichthe touch occurs. The views or windows in which a touch is detected maycorrespond to programmatic levels within a programmatic or viewhierarchy. For example, the lowest level view in which a touch isdetected may be called the hit view, and the set of events that arerecognized as proper inputs may be determined based, at least in part,on the hit view of the initial touch that begins a touch-based gesture.Alternatively, or additionally, events are recognized as proper inputsbased, at least in part, on one or more software programs (i.e.,software applications) in the programmatic hierarchy. For example, afive-finger pinch gesture is recognized as a proper input in anapplication launcher that has a five-finger pinch gesture recognizer,but not in a web browser application that does not have the five-fingerpinch gesture recognizer.

FIGS. 1A-1C are block diagrams illustrating different embodiments ofelectronic device 102, in accordance with some embodiments. Electronicdevice 102 may be any electronic device including, but not limited to, adesktop computer system, a laptop computer system, a mobile phone, asmart phone, a personal digital assistant, or a navigation system.Electronic device 102 may also be a portable electronic device with atouch screen display (e.g., touch-sensitive display 156, FIG. 1B)configured to present a user interface, a computer with a touch screendisplay configured to present a user interface, a computer with a touchsensitive surface and a display configured to present a user interface,or any other form of computing device, including without limitation,consumer electronic devices, mobile telephones, video game systems,electronic music players, tablet PCs, electronic book reading systems,e-books, PDAs, electronic organizers, email devices, laptops or othercomputers, kiosk computers, vending machines, smart appliances, etc.Electronic device 102 includes user interface 113.

In some embodiments, electronic device 102 includes a touch-sensitivedisplay 156 (FIG. 1B). In these embodiments, user interface 113 mayinclude an on-screen keyboard (not depicted) that is used by a user tointeract with electronic device 102. In some embodiments, electronicdevice 102 also includes one or more input devices 128 (e.g., keyboard,mouse, trackball, microphone, physical button(s), touchpad, etc.). Insome embodiments, touch-sensitive display 156 has the ability to detecttwo or more distinct, concurrent (or partially concurrent) touches, andin these embodiments, display 156 is sometimes herein called amultitouch display or multitouch-sensitive display. In some embodiments,a keyboard of the one or more input devices 128 may be separate anddistinct from electronic device 102. For example, a keyboard may be awired or wireless keyboard coupled to electronic device 102.

In some embodiments, electronic device 102 includes display 126 and oneor more input devices 128 (e.g., keyboard, mouse, trackball, microphone,physical button(s), touchpad, trackpad, etc.) that are coupled toelectronic device 102. In these embodiments, one or more of inputdevices 128 may optionally be separate and distinct from electronicdevice 102. For example, the one or more input devices may include oneor more of: a keyboard, a mouse, a trackpad, a trackball, and anelectronic pen, any of which may optionally be separate from theelectronic device. Optionally, device 102 may include one or moresensors 116, such as one or more accelerometers, gyroscopes, GPSsystems, speakers, infrared (IR) sensors, biometric sensors, cameras,etc. It is noted that the description above of various exemplary devicesas input devices 128 or as sensors 116 is of no significance to theoperation of the embodiments described herein, and that any input orsensor device described herein as an input device may equally well bedescribed as a sensor, and vice versa. In some embodiments, signalsproduced by one or more sensors 116 are used as input sources fordetecting events.

In some embodiments, electronic device 102 includes touch-sensitivedisplay 156 (i.e., a display having a touch-sensitive surface) and oneor more input devices 128 that are coupled to electronic device 102(FIG. 1B). In some embodiments, touch-sensitive display 156 has theability to detect two or more distinct, concurrent (or partiallyconcurrent) touches, and in these embodiments, display 156 is sometimesherein called a multitouch display or multitouch-sensitive display.

In some embodiments of electronic device 102 discussed herein, inputdevices 128 are disposed in electronic device 102. In other embodiments,one or more of input devices 128 is separate and distinct fromelectronic device 102. For example, one or more of input devices 128 maybe coupled to electronic device 102 by a cable (e.g., USB cable) orwireless connection (e.g., Bluetooth connection).

When using input devices 128, or when performing a touch-based gestureon touch-sensitive display 156 of electronic device 102, the usergenerates a sequence of sub-events that are processed by one or moreCPUs 110 of electronic device 102. In some embodiments, one or more CPUs110 of the electronic device 102 process the sequence of sub-events torecognize events.

Electronic device 102 typically includes one or more single- ormulti-core processing units (“CPU” or “CPUs”) 110 as well as one or morenetwork or other communications interfaces 112. Electronic device 102includes memory 111 and one or more communication buses 115 forinterconnecting these components. Communication buses 115 may includecircuitry (sometimes called a chipset) that interconnects and controlscommunications between system components (not depicted herein). Asdiscussed above, electronic device 102 includes user interfaces 113including a display (e.g., display 126 or touch-sensitive display 156).Further, electronic device 102 typically includes input devices 128(e.g., keyboard, mouse, touch sensitive surfaces, keypads, etc.). Insome embodiments, the input devices 128 include an on-screen inputdevice (e.g., a touch-sensitive surface of a display device). Memory 111may include high-speed random access memory, such as DRAM, SRAM, DDR RAMor other random access solid state memory devices; and may includenon-volatile memory, such as one or more magnetic disk storage devices,optical disk storage devices, flash memory devices, or othernon-volatile solid state storage devices. Memory 111 may optionallyinclude one or more storage devices remotely located from the CPU(s)110. Memory 111, or alternately the non-volatile memory device(s) withinmemory 111, comprise a computer readable storage medium. In someembodiments, memory 111, or the non-volatile memory device(s) withinmemory 111, comprises a non-transitory computer readable storage medium.In some embodiments, memory 111 (of electronic device 102) or thecomputer readable storage medium of memory 111 stores the followingprograms, modules and data structures, or a subset thereof:

-   -   operating system 118, which includes procedures for handling        various basic system services and for performing hardware        dependent tasks;    -   accessibility module 127 (FIG. 1C), which is used for modifying        behavior of one or more software applications in application        software 124 or modifying data from touch-sensitive display 156        or input device(s) 128 to improve accessibility of the one or        more software applications in application software 124 or        accessibility to content (e.g., a web page) displayed therein        (e.g., for people with impaired vision or limited motion        capabilities);    -   communication module 120, which is used for connecting        electronic device 102 to other devices via one or more        respective communication interfaces 112 (wired or wireless) and        one or more communication networks, such as the Internet, other        wide area networks, local area networks, metropolitan area        networks, and so on;    -   user interface module 123 (FIG. 1C), which is used for        displaying user interfaces including user interface objects on        display 126 or touch-sensitive display 156;    -   control application 132 (FIG. 1C), which is used for controlling        processes (e.g., hit view determination, thread management,        and/or event monitoring, etc.); in some embodiments, control        application 132 includes a run-time application; in other        embodiments, the run-time application includes control        application 132;    -   event delivery system 122, which may be implemented in various        alternate embodiments within operating system 118 or in        application software 124; in some embodiments, however, some        aspects of event delivery system 122 may be implemented in        operating system 118 while other aspects are implemented in        application software 124;    -   application software 124, which includes one or more software        applications (e.g., applications 133-1, 133-2, and 133-3 in FIG.        1C, each of which can be one of: an email application, a web        browser application, a notes application, a text messaging        application, etc.); a respective software application typically        has, at least during execution, an application state, indicating        the state of the respective software application and its        components (e.g., gesture recognizers); see application internal        state 321 (FIG. 3D) described below; and    -   device/global internal state 134 (FIG. 1C), which includes one        or more of: application state, indicating the state of software        applications and their components (e.g., gesture recognizers and        delegates); display state, indicating what applications, views        or other information occupy various regions of touch-sensitive        display 156 or display 126; sensor state, including information        obtained from the device's various sensors 116, input devices        128, and/or touch-sensitive display 156; location information        concerning the device's location and/or attitude; and other        states.

As used in the specification and claims, the term “open application”refers to a software application with retained state information (e.g.,as part of device/global internal state 134 and/or application internalstate 321 (FIG. 3D)). An open application is any one of the followingtypes of applications:

-   -   an active application, which is currently displayed on display        126 or touch-sensitive display 156 (or a corresponding        application view is currently displayed on the display);    -   a background application (or background process), which is not        currently displayed on display 126 or touch-sensitive display        156, but one or more application processes (e.g., instructions)        for the corresponding application are being processed by one or        more processors 110 (i.e., running);    -   a suspended application, which is not currently running, and the        application is stored in a volatile memory (e.g., DRAM, SRAM,        DDR RAM, or other volatile random access solid state memory        device of memory 111); and    -   a hibernated application, which is not running, and the        application is stored in a non-volatile memory (e.g., one or        more magnetic disk storage devices, optical disk storage        devices, flash memory devices, or other non-volatile solid state        storage devices of memory 111).

As used herein, the term “closed application” refers to softwareapplications without retained state information (e.g., state informationfor closed applications is not stored in a memory of the device).Accordingly, closing an application includes stopping and/or removingapplication processes for the application and removing state informationfor the application from the memory of the device. Generally, opening asecond application while in a first application does not close the firstapplication. When the second application is displayed and the firstapplication ceases to be displayed, the first application, which was anactive application when displayed, may become a background application,suspended application, or hibernated application, but the firstapplication remains an open application while its state information isretained by the device.

Each of the above identified elements may be stored in one or more ofthe previously mentioned memory devices. Each of the above identifiedmodule, application or system elements corresponds to a set ofinstructions for performing functions described herein. The set ofinstructions can be executed by one or more processors (e.g., one ormore CPUs 110). The above identified modules or programs (i.e., sets ofinstructions) need not be implemented as separate software programs,procedures or modules, and thus various subsets of these modules may becombined or otherwise rearranged in various embodiments. In someembodiments, memory 111 may store a subset of the modules and datastructures identified above. Furthermore, memory 111 may storeadditional modules and data structures not described above.

FIG. 2 is a diagram of input/output processing stack 200 of an exemplaryelectronic device or apparatus (e.g., device 102) according to someembodiments of the invention. Hardware (e.g., electronic circuitry) 212of the device is at the base level of the input/output processing stack200. Hardware 212 can include various hardware interface components,such as the components depicted in FIGS. 1A and/or 1B. Hardware 212 canalso include one or more of above mentioned sensors 116. At least someof the other elements (202-210) of input/output processing stack 200 aresoftware procedures, or portions of software procedures, that processinputs received from hardware 212 and generate various outputs that arepresented through a hardware user interface (e.g., one or more of adisplay, speakers, device vibration actuator, etc.).

A driver or a set of drivers 210 communicates with hardware 212. Drivers210 can receive and process input data received from hardware 212. CoreOperating System (“OS”) 208 can communicate with driver(s) 210. Core OS208 can process raw input data received from driver(s) 210. In someembodiments, drivers 210 can be considered to be a part of core OS 208.

A set of OS application programming interfaces (“OS APIs”) 206, aresoftware procedures that communicate with core OS 208. In someembodiments, APIs 206 are included in the device's operating system, butat a level above core OS 208. APIs 206 are designed for use byapplications running on the electronic devices or apparatuses discussedherein. User interface (UI) APIs 204 can utilize OS APIs 206.Application software (“applications”) 202 running on the device canutilize UI APIs 204 in order to communicate with the user. UI APIs 204can, in turn, communicate with lower level elements, ultimatelycommunicating with various user interface hardware, e.g., multitouchdisplay 156. In some embodiments, application software 202 includesapplications in application software 124 (FIG. 1A).

While each layer input/output processing stack 200 can utilize the layerunderneath it, that is not always required. For example, in someembodiments, applications 202 may directly communicate with OS APIs 206.In general, layers at or above OS API layer 206 may not directly accessCore OS 208, driver(s) 210, or hardware 212, as these layers areconsidered private. Applications in layer 202 and UI API 204 usuallydirect calls to the OS API 206, which in turn, accesses the layers CoreOS 208, driver(s) 210, and hardware 212.

Stated in another way, one or more hardware elements 212 of electronicdevice 102, and software running on the device detect input events(which may correspond to sub-events in a gesture) at one or more of theinput device(s) 128 and/or a touch-sensitive display 156 and generate orupdate various data structures (stored in memory 111 of device 102) usedby a set of currently active event recognizers to determine whether andwhen the input events correspond to an event to be delivered toapplication software 124. Embodiments of event recognitionmethodologies, apparatus and computer program products are described inmore detail below.

FIG. 3A depicts an exemplary view hierarchy 300, which in this exampleis a search program displayed in outermost view 302. Outermost view 302generally encompasses the entire user interface a user may directlyinteract with, and includes subordinate views, e.g.,

-   -   search results panel 304, which groups search results and can be        scrolled vertically;    -   search field 306, which accepts text inputs; and    -   a home row 310, which groups applications for quick access.

In this example, each subordinate view includes lower-level subordinateviews. In other examples, the number of view levels in the hierarchy 300may differ in different branches of the hierarchy, with one or moresubordinate views having lower-level subordinate views, and one or moreother subordinate views not have any such lower-level subordinate views.Continuing with the example shown in FIG. 3A, search results panel 304contains separate subordinate views 305 (subordinate to panel 304) foreach search result. Here, this example shows one search result in asubordinate view called the maps view 305. Search field 306 includes asubordinate view herein called clear contents icon view 307, whichclears the contents of the search field when a user performs aparticular action (e.g., a single touch or tap gesture) on the clearcontents icon in view 307. Home row 310 includes subordinate views310-1, 310-2, 310-3, and 310-4, which respectively correspond to acontacts application, an email application, a web browser, and an iPodmusic interface.

A touch sub-event 301-1 is represented in outermost view 302. Given thelocation of touch sub-event 301-1 over both the search results panel304, and maps view 305, the touch sub-event is also represented overthose views as 301-2 and 301-3, respectively. Actively involved views ofthe touch sub-event include the views search results panel 304, mapsview 305 and outermost view 302. Additional information regardingsub-event delivery and actively involved views is provided below withreference to FIGS. 3B and 3C.

Views (and corresponding programmatic levels) can be nested. In otherwords, a view can include other views. Consequently, the softwareelement(s) (e.g., event recognizers) associated with a first view caninclude or be linked to one or more software elements associated withviews within the first view. While some views can be associated withapplications, others can be associated with high level OS elements, suchas graphical user interfaces, window managers, etc. In some embodiments,some views are associated with other OS elements. In some embodiments,the view hierarchy includes views from a plurality of softwareapplications. For example, the view hierarchy may include a view from anapplication launcher (e.g., a home screen) and a view from a web browserapplication (e.g., a view including content of a web page).

A programmatic hierarchy includes one or more software elements orsoftware applications in a hierarchy. To simplify subsequent discussion,reference will generally be made only to views and the view hierarchy,but it must be understood that in some embodiments, the method mayoperate with a programmatic hierarchy with a plurality of programmaticlayers, and/or a view hierarchy.

FIGS. 3B and 3C depict exemplary methods and structures related to eventrecognizers. FIG. 3B depicts methods and data structures for eventhandling when event handlers are associated with particular views withina hierarchy of views. FIG. 3C depicts methods and data structures forevent handling when event handlers are associated with particular levelswithin a hierarchy of programmatic levels. Event recognizer globalmethods 312 and 350 include hit view and hit level determination modules314 and 352, respectively, active event recognizer determination modules316 and 354, and sub-event delivery modules 318 and 356.

In some embodiments, electronic device 102 includes one or more of:event recognizer global methods 312 and 350. In some embodiments,electronic device 102 includes one or more of: hit view determinationmodule 314 and hit level determination module 352. In some embodiments,electronic device 102 includes one or more of: active event recognizerdetermination modules 316 and 354. In some embodiments, electronicdevice 102 includes one or more of: sub-event delivery modules 318 and356. In some embodiments, one or more of these methods and modules areincluded in fewer or more methods and modules. For example, in someembodiments, electronic device 102 includes a hit view/leveldetermination module which includes the functionality of hit viewdetermination module 314 and hit level determination module 352. In someembodiments, electronic device 102 includes an active event recognizerdetermination module which includes the functionality of active eventrecognizer determination modules 316 and 354.

Hit view and hit level determination modules, 314 and 352, respectively,provide software procedures for determining where a sub-event has takenplace within one or more views (e.g., the exemplary view hierarchy 300depicted in FIG. 3A, which has three main branches) and/or one or moresoftware elements in the programmatic hierarchy that correspond to thesub-event (e.g., one or more of applications 133 in FIG. 1C).

The hit view determination module 314 of FIG. 3B, receives informationrelated to a sub-event, e.g., a user touch represented as 301-1 on theoutermost view 302, on a search result (maps view 305) and the searchresults panel view 304. The hit view determination module 314 identifiesa hit-view as the lowest view in the hierarchy which should handle thesub-event. In most circumstances, the hit view is the lowest level viewin which an initiating sub-event (i.e., the first sub-event in thesequence of sub-events that form an event or potential event) occurs. Insome embodiments, once the hit-view is identified, it will receive allsub-events related to the same touch or input source for which the hitview was identified. In some embodiments, one or more other views (e.g.,a default or predefined view) receive at least some of the sub-eventsthat the hit view receives.

In some embodiments, the hit level determination module 352 of FIG. 3Cmay utilize an analogous process. For example, in some embodiments, thehit level determination module 352 identifies a hit level as the lowestlevel in the programmatic hierarchy (or a software application in thelowest programmatic level in the programmatic hierarchy) which shouldhandle the sub-event. In some embodiments, once the hit level isidentified, it or a software application in the hit level will receiveall sub-events related to the same touch or input source for which thehit level was identified. In some embodiments, one or more other levelsor software applications (e.g., a default or predefined softwareapplication) receive at least some of the sub-events that the hit viewreceives.

Active event recognizer determination modules 316 and 354 of eventrecognizer global methods 312 and 350, respectively, determine whichview or views within a view hierarchy and/or a programmatic hierarchyshould receive a particular sequence of sub-events. FIG. 3A depicts anexemplary set of active views, 302, 304 and 305, that receive thesub-event 301. In the example of FIG. 3A, the active event recognizerdetermination module 316 would determine that the outermost view 302,search results panel 304 and maps view 305 are actively involved viewsbecause these views include the physical location of the touchrepresented by sub-event 301. It is noted that even if touch sub-event301 were entirely confined to the area associated with maps view 305,search results panel 304 and outermost view 302 would still remain inthe actively involved views since the search results panel 304 andoutermost view 302 are ancestors of maps view 305.

In some embodiments, active event recognizer determination modules 316and 354 utilize analogous processes. In the example of FIG. 3A, theactive event recognizer determination module 350 would determine thatthe map application is actively involved because the views of the mapapplication are displayed and/or the views of the map applicationinclude the physical location of the touch represented by sub-event 301.It is noted that even if touch sub-event 301 were entirely confined tothe area associated with the map application, other applications in theprogrammatic hierarchy may still remain as actively involvedapplications (or applications in the actively involved programmaticlevels).

Sub-event delivery module 318 delivers sub-events to event recognizersfor actively involved views. Using the example of FIG. 3A, a user'stouch is represented in different views of the hierarchy by touch marks301-1, 301-2, and 301-3. In some embodiments, sub-event datarepresenting this user's touch is delivered by the sub-event deliverymodule 318 to event recognizers at the actively involved views, i.e.,top level view 302, search results panel 304 and maps view 305. Further,the event recognizers of a view can receive subsequent sub-events of anevent that starts within the view (e.g., when an initial sub-eventoccurs within the view). Stated in another way, a view can receivesub-events associated with user interactions beginning in the view, evenif it continues outside of the view.

In some embodiments, sub-event delivery module 356 delivers sub-eventsto event recognizers for actively involved programmatic levels in aprocess analogous to that used by sub-event delivery module 318. Forexample, sub-event delivery module 356 delivers sub-events to eventrecognizers for actively involved applications. Using the example ofFIG. 3A, a user's touch 301 is delivered by sub-event delivery module356 to event recognizers at the actively involved views (e.g., the mapapplication and any other actively involved applications in theprogrammatic hierarchy). In some embodiments, a default or predefinedsoftware application is included in the programmatic hierarchy bydefault.

In some embodiments, a separate event recognizer structure 320 or 360 isgenerated and stored in memory of the device for each actively involvedevent recognizer. Event recognizer structures 320 and 360 typicallyinclude an event recognizer state 334, 374, respectively (discussed ingreater detail below when referring to FIGS. 4A and 4B), and eventrecognizer specific code 338, 378, respectively, having state machines340, 380, respectively. Event recognizer structure 320 also includes aview hierarchy reference 336, while event recognizer structure 360includes a programmatic hierarchy reference 376. Each instance of aparticular event recognizer references exactly one view or programmaticlevel. View hierarchy reference 336 or programmatic hierarchy reference376 (for a particular event recognizer) is used to establish which viewor programmatic level is logically coupled to the respective eventrecognizer.

View metadata 341 and level metadata 381 may include data regarding aview or level, respectively. View or level metadata may include at leastthe following properties that may influence sub-event delivery to eventrecognizers:

-   -   A stop property 342, 382, which, when set for a view or        programmatic level prevents sub-event delivery to event        recognizers associated with the view or programmatic level as        well as its ancestors in the view or programmatic hierarchy.    -   A skip property 343, 383, which, when set for a view or        programmatic level prevents sub-event delivery to event        recognizers associated with that view or programmatic level, but        permits sub-event delivery to its ancestors in the view or        programmatic hierarchy.    -   A NoHit skip property 344, 384, which, when set for a view,        prevents delivery of sub-events to event recognizers associated        with the view unless the view is the hit view. As discussed        above, the hit view determination module 314 identifies a        hit-view (or hit level in the case of hit level determination        module 352) as the lowest view in the hierarchy which should        handle the sub-event.

Event recognizer structures 320 and 360 may include metadata 322, 362,respectively. In some embodiments, the metadata 322, 362 includesconfigurable properties, flags, and lists that indicate how the eventdelivery system should perform sub-event delivery to actively involvedevent recognizers. In some embodiments, metadata 322, 362 may includeconfigurable properties, flags, and lists that indicate how eventrecognizers may interact with one another. In some embodiments, metadata322, 362 may include configurable properties, flags, and lists thatindicate whether sub-events are delivered to varying levels in the viewor programmatic hierarchy. In some embodiments, the combination of eventrecognizer metadata 322, 362 and view or level metadata (341, 381,respectively) are both be used to configure the event delivery systemto: a) perform sub-event delivery to actively involved eventrecognizers, b) indicate how event recognizers may interact with oneanother, and c) indicate whether and when sub-events are delivered tovarious levels in the view or programmatic hierarchy.

It is noted that, in some embodiments, a respective event recognizersends an event recognition action 333, 373 to its respective target 335,375, as specified by fields of the event recognizer's structure 320,360. Sending an action to a target is distinct from sending (anddeferred sending) sub-events to a respective hit view or level.

The metadata properties stored in a respective event recognizerstructure 320, 360 of a corresponding event recognizer includes one ormore of:

-   -   An exclusivity flag 324, 364, which, when set for an event        recognizer, indicates that upon recognition of an event by the        event recognizer, the event delivery system should stop        delivering sub-events to any other event recognizers of the        actively involved views or programmatic levels (with the        exception of any other event recognizers listed in an exception        list 326, 366). When receipt of a sub-event causes a particular        event recognizer to enter the exclusive state, as indicated by        its corresponding exclusivity flag 324 or 364, then subsequent        sub-events are delivered only to the event recognizer in the        exclusive state (as well as any other event recognizers listed        in an exception list 326, 366).    -   Some event recognizer structures 320, 360, may include an        exclusivity exception list 326, 366. When included in the event        recognizer structure 320, 360 for a respective event recognizer,        this list 326, 366 indicates the set of event recognizers, if        any, that are to continue receiving sub-events even after the        respective event recognizer has entered the exclusive state. For        example, if the event recognizer for a single tap event enters        the exclusive state, and the currently involved views include an        event recognizer for a double tap event, then the list 320, 360        would list the double tap event recognizer so that a double tap        event can be recognized even after a single tap event has been        detected. Accordingly, the exclusivity exception list 326, 366        permits event recognizers to recognize different events that        share common sequences of sub-events, e.g., a single tap event        recognition does not preclude subsequent recognition of a double        or triple tap event by other event recognizers.    -   Some event recognizer structures 320, 360, may include a        wait-for list 327, 367. When included in the event recognizer        structure 320, 360 for a respective event recognizer, this list        327, 367 indicates the set of event recognizers, if any, that        must enter the event impossible or event canceled state before        the respective event recognizer can recognize a respective        event. In effect, the listed event recognizers have higher        priority for recognizing an event than the event recognizer with        the wait-for list 327, 367.    -   A delay touch began flag 328, 368, which, when set for an event        recognizer, causes the event recognizer to delay sending        sub-events (including a touch begin or finger down sub-event,        and subsequent events) to the event recognizer's respective hit        view or level until after it has been determined that the        sequence of sub-events does not correspond to this event        recognizer's event type. This flag can be used to prevent the        hit view or level from ever seeing any of the sub-events in the        case where the gesture is recognized. When the event recognizer        fails to recognize an event, the touch began sub-event (and        sub-sequent touch end sub-event) can be delivered to the hit        view or level. In one example, delivering such sub-events to the        hit view or level causes the user interface to briefly highlight        an object, without invoking the action associated with that        object.    -   A delay touch end flag 330, 370, which, when set for an event        recognizer, causes the event recognizer to delay sending a        sub-event (e.g., a touch end sub-event) to the event        recognizer's respective hit view or level until it has been        determined that the sequence of sub-events does not correspond        to this event recognizer's event type. This can be used to        prevent the hit view or level from acting upon a touch end        sub-event, in case the gesture is later recognized. As long as        the touch end sub-event is not sent, a touch canceled can be        sent to the hit view or level. If an event is recognized, the        corresponding action by an application is preformed, and the        touch end sub-event is delivered to the hit view or level.    -   A touch cancellation flag 332, 372, which, when set for an event        recognizer, causes the event recognizer to send touch or input        cancellation to the event recognizer's respective hit view or        hit level when it has been determined that the sequence of        sub-events does not correspond to this event recognizer's event        type. The touch or input cancellation sent to the hit view or        level indicates that a prior sub-event (e.g., a touch began        sub-event) has been cancelled. The touch or input cancellation        may cause the input source handler's state (see FIG. 4B) to        enter the input sequence cancelled state 460 (discussed below).

In some embodiments, the exception list 326, 366 can also be used bynon-exclusive event recognizers. In particular, when a non-exclusiveevent recognizer recognizes an event, subsequent sub-events are notdelivered to the exclusive event recognizers associated with thecurrently active views, except for those exclusive event recognizerslisted in the exception list 326, 366 of the event recognizer thatrecognized the event.

In some embodiments, event recognizers may be configured to utilize thetouch cancellation flag in conjunction with the delay touch end flag toprevent unwanted sub-events from being delivered to the hit view. Forexample, the definition of a single tap gesture and the first half of adouble tap gesture are identical. Once a single tap event recognizersuccessfully recognizes a single tap, an undesired action could takeplace. If the delay touch end flag is set, the single tap eventrecognizer is prevented from sending sub-events to the hit view until asingle tap event is recognized. In addition, the wait-for list of thesingle tap event recognizer may identify the double-tap eventrecognizer, thereby preventing the single tap event recognizer fromrecognizing a single tap until the double-tap event recognizer hasentered the event impossible state. The use of the wait-for list avoidsthe execution of actions associated with a single tap when a double tapgesture is performed. Instead, only actions associated with a double tapwill be executed, in response to recognition of the double tap event.

Turning in particular to forms of user touches on touch-sensitivesurfaces, as noted above, touches and user gestures may include an actthat need not be instantaneous, e.g., a touch can include an act ofmoving or holding a finger against a display for a period of time. Atouch data structure, however, defines the state of a touch (or, moregenerally, the state of any input source) at a particular time.Therefore, the values stored in a touch data structure may change overthe course of a single touch, enabling the state of the single touch atdifferent points in time to be conveyed to an application.

Each touch data structure can comprise various fields. In someembodiments, touch data structures may include data corresponding to atleast the touch-specific fields 339 in FIG. 3B or input source specificfields 379 in FIG. 3C.

For example, a “first touch for view” field 345 in FIG. 3B (385 for“first touch for level” in FIG. 3C) can indicate whether the touch datastructure defines the first touch for the particular view (since thesoftware element implementing the view was instantiated). A “time stamp”field 346, 386 can indicate the particular time to which the touch datastructure relates.

Optionally, an “info” field 347, 387 can be used to indicate if a touchis a rudimentary gesture. For example, the “info” field 347, 387 canindicate whether the touch is a swipe and, if so, in which direction theswipe is oriented. A swipe is a quick drag of one or more fingers in astraight direction. API implementations (discussed below) can determineif a touch is a swipe and pass that information to the applicationthrough the “info” field 347, 387, thus alleviating the application ofsome data processing that would have been necessary if the touch were aswipe.

Optionally, a “tap count” field 348 in FIG. 3B (“event count” field 388in FIG. 3C) can indicate how many taps have been sequentially performedat the position of the initial touch. A tap can be defined as a quickpressing and lifting of a finger against a touch-sensitive panel at aparticular position. Multiple sequential taps can occur if the finger isagain pressed and released in quick succession at the same position ofthe panel. An event delivery system 122 can count taps and relay thisinformation to an application through the “tap count” field 348.Multiple taps at the same location are sometimes considered to be auseful and easy to remember command for touch enabled interfaces. Thus,by counting taps, the event delivery system 122 can again alleviate somedata processing from the application.

A “phase” field 349, 389 can indicate a particular phase the touch-basedgesture is currently in. The phase field 349, 389 can have variousvalues, such as “touch phase began” which can indicate that the touchdata structure defines a new touch that has not been referenced byprevious touch data structures. A “touch phase moved” value can indicatethat the touch being defined has moved from a prior position. A “touchphase stationary” value can indicate that the touch has stayed in thesame position. A “touch phase ended” value can indicate that the touchhas ended (e.g., the user has lifted his/her finger from the surface ofa multi touch display). A “touch phase cancelled” value can indicatethat the touch has been cancelled by the device. A cancelled touch canbe a touch that is not necessarily ended by a user, but which the devicehas determined to ignore. For example, the device can determine that thetouch is being generated inadvertently (i.e., as a result of placing aportable multi touch enabled device in one's pocket) and ignore thetouch for that reason. Each value of the “phase field” 349, 389 can bean integer number.

Thus, each touch data structure can define what is happening with arespective touch (or other input source) at a particular time (e.g.,whether the touch is stationary, being moved, etc.) as well as otherinformation associated with the touch (such as position). Accordingly,each touch data structure can define the state of a particular touch ata particular moment in time. One or more touch data structuresreferencing the same time can be added in a touch event data structurethat can define the states of all touches a particular view is receivingat a moment in time (as noted above, some touch data structures may alsoreference touches that have ended and are no longer being received).Multiple touch event data structures can be sent to the softwareimplementing a view as time passes, in order to provide the softwarewith continuous information describing the touches that are happening inthe view.

FIG. 3D is a block diagram illustrating exemplary components for eventhandling (e.g., event handling components 390) in accordance with someembodiments. In some embodiments, memory 111 (FIG. 1A) includes eventrecognizer global methods 312 and one or more applications (e.g., 133-1through 133-3).

In some embodiments, event recognizer global methods 312 include eventmonitor 311, hit view determination module 314, active event recognizerdetermination module 316, and event dispatcher module 315. In someembodiments, event recognizer global methods 312 are located withinevent delivery system 122 (FIG. 1A). In some embodiments, eventrecognizer global methods 312 are implemented in operating system 118(FIG. 1A). Alternatively, event recognizer global methods 312 areimplemented in a respective application 133-1. In yet other embodiments,event recognizer global methods 312 are implemented as a stand-alonemodule, or a part of another module stored in memory 111 (e.g., acontact/motion module (not depicted)).

Event monitor 311 receives event information from one or more sensors116, touch-sensitive display 156, and/or one or more input devices 128.Event information includes information about an event (e.g., a usertouch on touch-sensitive display 156, as part of a multi-touch gestureor a motion of device 102) and/or a sub-event (e.g., a movement of atouch across touch-sensitive display 156). For example, eventinformation for a touch event includes one or more of: a location andtime stamp of a touch. Similarly, event information for a swipe eventincludes two or more of: a location, time stamp, direction, and speed ofa swipe. Sensors 116, touch-sensitive display 156, and input devices 128transmit information event and sub-event information to event monitor311 either directly or through a peripherals interface, which retrievesand stores event information. Sensors 116 include one or more of:proximity sensor, accelerometer(s), gyroscopes, microphone, and videocamera. In some embodiments, sensors 116 also include input devices 128and/or touch-sensitive display 156.

In some embodiments, event monitor 311 sends requests to sensors 116and/or the peripherals interface at predetermined intervals. Inresponse, sensors 116 and/or the peripherals interface transmit eventinformation. In other embodiments, sensors 116 and the peripheralinterface transmit event information only when there is a significantevent (e.g., receiving an input beyond a predetermined noise thresholdand/or for more than a predetermined duration).

Event monitor 311 receives event information and relays the eventinformation to event dispatcher module 315. In some embodiments, eventmonitor 311 determines one or more respective applications (e.g., 133-1)to which to deliver the event information. In some embodiments, eventmonitor 311 also determines one or more respective application views 317of the one or more respective applications to which to deliver the eventinformation.

In some embodiments, event recognizer global methods 312 also include ahit view determination module 314 and/or an active event recognizerdetermination module 316.

Hit view determination module 314, if present, provides softwareprocedures for determining where an event or a sub-event has taken placewithin one or more views, when touch-sensitive display 156 displays morethan one view. Views are made up of controls and other elements that auser can see on the display.

Another aspect of the user interface associated with a respectiveapplication (e.g., 133-1) is a set of views 317, sometimes herein calledapplication views or user interface windows, in which information isdisplayed and touch-based gestures occur. The application views (of arespective application) in which a touch is detected may correspond to aparticular view within a view hierarchy of the application. For example,the lowest level view in which a touch is detected may be called the hitview, and the set of events that are recognized as proper inputs may bedetermined based, at least in part, on the hit view of the initial touchthat begins a touch-based gesture.

Hit view determination module 314 receives information related to eventsand/or sub-events. When an application has multiple views organized in ahierarchy, hit view determination module 314 identifies a hit view asthe lowest view in the hierarchy which should handle the event orsub-event. In most circumstances, the hit view is the lowest level viewin which an initiating event or sub-event occurs (i.e., the first eventor sub-event in the sequence of events and/or sub-events that form agesture). Once the hit view is identified by the hit view determinationmodule, the hit view typically receives all events and/or sub-eventsrelated to the same touch or input source for which it was identified asthe hit view. However, the hit view is not always a sole view thatreceives all events and/or sub-events related to the same touch or inputsource for which it was identified as the hit view. Stated differently,in some embodiments, another application (e.g., 133-2) or another viewof the same application also receives at least a subset of the eventsand/or sub-events related to the same touch or input source regardlessof whether a hit view has been determined for the touch or input source.

Active event recognizer determination module 316 determines which viewor views within a view hierarchy should receive a particular sequence ofevents and/or sub-events. In some application contexts, active eventrecognizer determination module 316 determines that only the hit viewshould receive a particular sequence of events and/or sub-events. Inother application contexts, active event recognizer determination module316 determines that all views that include the physical location of anevent or sub-event are actively involved views, and therefore determinesthat all actively involved views should receive a particular sequence ofevents and/or sub-events. In other application contexts, even if touchevents and/or sub-events are entirely confined to the area associatedwith one particular view, views higher in the hierarchy still remain asactively involved views and thus the views higher in the hierarchyshould receive a particular sequence of events and/or sub-events.Additionally, or alternatively, active event recognizer determinationmodule 316 determines which application(s) in a programmatic hierarchyshould receive a particular sequence of events and/or sub-events. Thus,in some embodiments, active event recognizer determination module 316determines that only a respective application in the programmatichierarchy should receive a particular sequence of events and/orsub-events. In some embodiments, active event recognizer determinationmodule 316 determines that a plurality of applications in theprogrammatic hierarchy should receive a particular sequence of eventsand/or sub-events.

Event dispatcher module 315 dispatches the event information to an eventrecognizer (also called herein “gesture recognizer”) (e.g., eventrecognizer 325-1). In embodiments including active event recognizerdetermination module 316, event dispatcher module 315 delivers the eventinformation to an event recognizer determined by active event recognizerdetermination module 316. In some embodiments, event dispatcher module315 stores in an event queue the event information, which is retrievedby a respective event recognizer 325 (or event receiver 3031 in arespective event recognizer 325).

In some embodiments, a respective application (e.g., 133-1) includesapplication internal state 321, which indicates the current applicationview(s) displayed on touch-sensitive display 156 when the application isactive or executing. In some embodiments, device/global internal state134 (FIG. 1C) is used by event recognizer global methods 312 todetermine which application(s) is(are) currently active, and applicationinternal state 321 is used by event recognizer global methods 312 todetermine application views 317 to which to deliver event information.

In some embodiments, application internal state 321 includes additionalinformation, such as one or more of: resume information to be used whenapplication 133-1 resumes execution, user interface state informationthat indicates information being displayed or that is ready for displayby application 133-1, a state queue for enabling the user to go back toa prior state or view of application 133-1, and a redo/undo queue ofprevious actions taken by the user. In some embodiments, applicationinternal state 321 further includes contextual information/text andmetadata 323.

In some embodiments, application 133-1 includes one or more applicationviews 317, each of which has corresponding instructions for handlingtouch events that occur within a respective view of the application'suser interface (e.g., a corresponding event handler 319). At least oneapplication view 317 of the application 133-1 includes one or more eventrecognizers 325. Typically, a respective application view 317 includes aplurality of event recognizers 325. In other embodiments, one or more ofevent recognizers 325 are part of a separate module, such as a userinterface kit (not shown) or a higher level object from whichapplication 133-1 inherits methods and other properties. In someembodiments, a respective application view 317 also includes one or moreof: data updater, object updater, GUI updater, and/or event datareceived.

A respective application (e.g., 133-1) also includes one or more eventhandlers 319. Typically, a respective application (e.g., 133-1) includesa plurality of event handlers 319.

A respective event recognizer 325-1 receives event information fromevent dispatcher module 315 (directly or indirectly through application133-1), and identifies an event from the event information. Eventrecognizer 325-1 includes event receiver 3031 and event comparator 3033.

The event information includes information about an event (e.g., atouch) or a sub-event (e.g., a touch movement). Depending on the eventor sub-event, the event information also includes additionalinformation, such as location of the event or sub-event. When the eventor sub-event concerns motion of a touch, the event information may alsoinclude speed and direction of the sub-event. In some embodiments,events include rotation of the device from one orientation to another(e.g., from a portrait orientation to a landscape orientation, or viceversa), and the event information includes corresponding informationabout the current orientation (also called device attitude) of thedevice.

Event comparator 3033 compares the event information to one or morepredefined gesture definitions (also called herein “event definitions”)and, based on the comparison, determines an event or sub-event, ordetermines or updates the state of an event or sub-event. In someembodiments, event comparator 3033 includes one or more gesturedefinitions 3035 (as described above, also called herein “eventdefinitions”). Gesture definitions 3035 contain definitions of gestures(e.g., predefined sequences of events and/or sub-events), for example,gesture 1 (3037-1), gesture 2 (3037-2), and others. In some embodiments,sub-events in gesture definitions 3035 include, for example, touchbegin, touch end, touch movement, touch cancellation, and multipletouching. In one example, the definition for gesture 1 (3037-1) is adouble tap on a displayed object. The double tap, for example, comprisesa first touch (touch begin) on the displayed object for a predeterminedphase of the gesture, a first lift-off (touch end) for a nextpredetermined phase of the gesture, a second touch (touch begin) on thedisplayed object for a subsequent predetermined phase of the gesture,and a second lift-off (touch end) for a final predetermined phase of thegesture. In another example, the definition for gesture 2 (3037-2)includes a dragging on a displayed object. The dragging, for example,comprises a touch (or contact) on the displayed object, a movement ofthe touch across touch-sensitive display 156, and lift-off of the touch(touch end).

In some embodiments, event recognizer 325-1 also includes informationfor event delivery 3039. Information for event delivery 3039 includesreferences to corresponding event handlers 319. Optionally, informationfor event delivery 3039 includes action-target pair(s). In someembodiments, in response to recognizing a gesture (or a part of agesture), event information (e.g., action message(s)) is sent to one ormore targets identified by the action-target pair(s). In otherembodiments, in response to recognizing a gesture (or a part of agesture), the action-target pair(s) are activated.

In some embodiments, gesture definitions 3035 include a definition of agesture for a respective user-interface object. In some embodiments,event comparator 3033 performs a hit test to determine whichuser-interface object is associated with a sub-event. For example, in anapplication view in which three user-interface objects are displayed ontouch-sensitive display 156, when a touch is detected on touch-sensitivedisplay 156, event comparator 3033 performs a hit test to determinewhich of the three user-interface objects, if any, is associated withthe touch (event). If each displayed object is associated with arespective event handler 319, event comparator 3033 uses the result ofthe hit test to determine which event handler 319 should be activated.For example, event comparator 3033 selects an event handler 319associated with the event and the object triggering the hit test.

In some embodiments, a respective gesture definition 3037 for arespective gesture also includes delayed actions that delay delivery ofthe event information until after it has been determined whether thesequence of events and/or sub-events does or does not correspond to theevent recognizer's event type.

When a respective event recognizer 325-1 determines that the series ofevents and/or sub-events do not match any of the events in gesturedefinitions 3035, the respective event recognizer 325-1 enters an eventfailed state, after which the respective event recognizer 325-1disregards subsequent events and/or sub-events of the touch-basedgesture. In this situation, other event recognizers, if any, that remainactive for the hit view continue to track and process events and/orsub-events of an ongoing touch-based gesture.

In some embodiments, when no event recognizer for the hit view remains,the event information is sent to one or more event recognizers in ahigher view in the view hierarchy. Alternatively, when no eventrecognizer for the hit view remains, the event information isdisregarded. In some embodiments, when no event recognizer for views inthe view hierarchy remains, the event information is sent to one or moreevent recognizers in a higher programmatic level in the programmatichierarchy. Alternatively, when no event recognizer for views in the viewhierarchy remains, the event information is disregarded.

In some embodiments, a respective event recognizer 325-1 includes eventrecognizer state 334. Event recognizer state 334 includes a state of therespective event recognizer 325-1. Examples of event recognizer statesare described in more detail below with reference to FIGS. 4A-4B and5A-5C.

In some embodiments, event recognizer state 334 includes recognizermetadata and properties 3043. In some embodiments, recognizer metadataand properties 3043 include one or more of the following: A)configurable properties, flags, and/or lists that indicate how the eventdelivery system should perform event and/or sub-event delivery toactively involved event recognizers; B) configurable properties, flags,and/or lists that indicate how event recognizers interact with oneanother; C) configurable properties, flags, and/or lists that indicatehow event recognizers receive event information; D) configurableproperties, flags, and/or lists that indicate how event recognizers mayrecognize a gesture; E) configurable properties, flags, and/or liststhat indicate whether events and/or sub-events are delivered to varyinglevels in the view hierarchy; and F) references to corresponding eventhandlers 319.

In some embodiments, event recognizer state 334 includes event/touchmetadata 3045. Event/touch metadata 3045 includes event/touchinformation about a respective event/touch that has been detected andcorresponds to a respective gesture definition 3037 of gesturedefinitions 3035. The event/touch information includes one or more of: alocation, time stamp, speed, direction, distance, scale (or change inscale), and angle (or change in angle) of the respective event/touch.

In some embodiments, a respective event recognizer 325 activates eventhandler 319 associated with the respective event recognizer 325 when oneor more particular events and/or sub-events of a gesture are recognized.In some embodiments, respective event recognizer 325 delivers eventinformation associated with the event to event handler 319.

Event handler 319, when activated, performs one or more of: creatingand/or updating data, creating and updating objects, and preparingdisplay information and sending it for display on display 126 ortouch-sensitive display 156.

In some embodiments, a respective application view 317-2 includes viewmetadata 341. As described above with respect to FIG. 3B, view metadata341 includes data regarding a view. Optionally, view metadata 341includes one or more of: stop property 342, skip property 343, NoHitskip property 344, and other view metadata 329.

In some embodiments, a first actively involved view within the viewhierarchy may be configured to prevent delivery of a respectivesub-event to event recognizers associated with that first activelyinvolved view. This behavior can implement the skip property 343. Whenthe skip property is set for an application view, delivery of therespective sub-event is still performed for event recognizers associatedwith other actively involved views in the view hierarchy.

Alternately, a first actively involved view within the view hierarchymay be configured to prevent delivery of a respective sub-event to eventrecognizers associated with that first actively involved view unless thefirst actively involved view is the hit view. This behavior canimplement the conditional NoHit skip property 344.

In some embodiments, a second actively involved view within the viewhierarchy is configured to prevent delivery of the respective sub-eventto event recognizers associated with the second actively involved viewand to event recognizers associated with ancestors of the secondactively involved view. This behavior can implement the stop property342.

FIG. 3E is a block diagram illustrating exemplary classes and instancesof gesture recognizers (e.g., event handling components 390) inaccordance with some embodiments.

A software application (e.g., application 133-1) has one or more eventrecognizers 3040. In some embodiments, a respective event recognizer(e.g., 3040-2) is an event recognizer class. The respective eventrecognizer (e.g., 3040-2) includes event recognizer specific code 338(e.g., a set of instructions defining the operation of eventrecognizers) and state machine 340.

In some embodiments, application state 321 of a software application(e.g., application 133-1) includes instances of event recognizers. Eachinstance of an event recognizer is an object having a state (e.g., eventrecognizer state 334). “Execution” of a respective event recognizerinstance is implemented by executing corresponding event recognizerspecific code (e.g., 338) and updating or maintaining the state 334 ofthe event recognizer instance 3047. The state 334 of event recognizerinstance 3047 includes the state 3038 of the event recognizer instance'sstate machine 340.

In some embodiments, application state 321 includes a plurality of eventrecognizer instances 3047. A respective event recognizer instance 3047typically corresponds to an event recognizer that has been bound (alsocalled “attached”) to a view of the application. In some embodiments,one or more event recognizer instances 3047 are bound to a respectiveapplication in a programmatic hierarchy without reference to anyparticular view of the respective application. In some embodiments,application state 321 includes a plurality of instances (e.g., 3047-1 to3047-L) of a respective event recognizer (e.g., 3040-2). In someembodiments, application state 321 includes instances 3047 of aplurality of event recognizers (e.g., 3040-1 to 3040-R).

In some embodiments, a respective instance 3047-2 of a gesturerecognizer 3040 includes event recognizer state 334. As discussed above,in some embodiments, event recognizer state 334 includes recognizermetadata and properties 3043 and event/touch metadata 3045. In someembodiments, event recognizer state 334 also includes view hierarchyreference(s) 336, indicating to which view the respective instance3047-2 of the gesture recognizer 3040-2 is attached.

In some embodiments, recognizer metadata and properties 3043 include thefollowing, or a subset or superset thereof:

-   -   exclusivity flag 324;    -   exclusivity exception list 326;    -   wait-for list 327;    -   delay touch began flag 328;    -   delay touch end flag 330; and    -   touch cancellation flag 332.

In some embodiments, one or more event recognizers may be adapted todelay delivering one or more sub-events of the sequence of sub-eventsuntil after the event recognizer recognizes the event. This behaviorreflects a delayed event. For example, consider a single tap gesture ina view for which multiple tap gestures are possible. In that case, a tapevent becomes a “tap+delay” recognizer. In essence, when an eventrecognizer implements this behavior, the event recognizer will delayevent recognition until it is certain that the sequence of sub-eventsdoes in fact correspond to its event definition. This behavior may beappropriate when a recipient view is incapable of appropriatelyresponding to cancelled events. In some embodiments, an event recognizerwill delay updating its event recognition status to its respectiveactively involved view until the event recognizer is certain that thesequence of sub-events does not correspond to its event definition.Delay touch began flag 328, delay touch end flag 330, and touchcancellation flag 332 are provided to tailor sub-event deliverytechniques, as well as event recognizer and view status informationupdates to specific needs.

In some embodiments, recognizer metadata and properties 3043 include thefollowing, or a subset or superset thereof:

-   -   state machine state/phase 3038, which indicates the state of a        state machine (e.g., 340) for the respective event recognizer        instance (e.g., 3047-2); state machine state/phase 3038 can have        various state values, such as “event possible”, “event        recognized”, “event failed”, and others, as described below;        alternatively or additionally, state machine state/phase 3038        can have various phase values, such as “touch phase began” which        can indicate that the touch data structure defines a new touch        that has not been referenced by previous touch data structures;        a “touch phase moved” value can indicate that the touch being        defined has moved from a prior position; a “touch phase        stationary” value can indicate that the touch has stayed in the        same position; a “touch phase ended” value can indicate that the        touch has ended (e.g., the user has lifted his/her finger from        the surface of a multi touch display); a “touch phase cancelled”        value can indicate that the touch has been cancelled by the        device; a cancelled touch can be a touch that is not necessarily        ended by a user, but which the device has determined to ignore;        for example, the device can determine that the touch is being        generated inadvertently (i.e., as a result of placing a portable        multi touch enabled device in one's pocket) and ignore the touch        for that reason; each value of state machine state/phase 3038        can be an integer number (called herein “gesture recognizer        state value”);    -   action-target pair(s) 3051, where each pair identifies a target        to which the respective event recognizer instance sends the        identified action message in response to recognizing an event or        touch as a gesture or a part of a gesture;    -   delegate 3053, which is a reference to a corresponding delegate        when a delegate is assigned to the respective event recognizer        instance; when a delegate is not assigned to the respective        event recognizer instance, delegate 346 contains a null value;        and    -   enabled property 3055, indicating whether the respective event        recognizer instance is enabled; in some embodiments, when the        respective event recognizer instance is not enabled (e.g.,        disabled), the respective event recognizer instance does not        process events or touches.

In some embodiments, exception list 326 can also be used bynon-exclusive event recognizers. In particular, when a non-exclusiveevent recognizer recognizes an event or sub-event, subsequent eventsand/or sub-events are not delivered to the exclusive event recognizersassociated with the currently active views, except for those exclusiveevent recognizers listed in exception list 326 of the event recognizerthat recognized the event or sub-event.

In some embodiments, event recognizers may be configured to utilize thetouch cancellation flag 332 in conjunction with the delay touch end flag330 to prevent unwanted events and/or sub-events from being delivered tothe hit view. For example, the definition of a single tap gesture andthe first half of a double tap gesture are identical. Once a single tapevent recognizer successfully recognizes a single tap, an undesiredaction could take place. If the delay touch end flag is set, the singletap event recognizer is prevented from sending sub-events to the hitview until a single tap event is recognized. In addition, the wait-forlist of the single tap event recognizer may identify the double-tapevent recognizer, thereby preventing the single tap event recognizerfrom recognizing a single tap until the double-tap event recognizer hasentered the event impossible state. The use of the wait-for list avoidsthe execution of actions associated with a single tap when a double tapgesture is performed. Instead, only actions associated with a double tapwill be executed, in response to recognition of the double tap event.

Turning in particular to forms of user touches on touch-sensitivesurfaces, as noted above, touches and user gestures may include an actthat need not be instantaneous, e.g., a touch can include an act ofmoving or holding a finger against a display for a period of time. Atouch data structure, however, defines the state of a touch (or, moregenerally, the state of any input source) at a particular time.Therefore, the values stored in a touch data structure may change overthe course of a single touch, enabling the state of the single touch atdifferent points in time to be conveyed to an application.

Each touch data structure can comprise various entries. In someembodiments, touch data structures may include data corresponding to atleast the touch-specific entries in event/touch metadata 3045 such asthe following, or a subset or superset thereof:

-   -   “first touch for view” entry 345;    -   “per touch info” entry 3051, including “time stamp” information,        which indicates the particular time to which the touch data        structure relates (e.g., the time of touch); optionally, “per        touch info” entry 3051 includes other information, such as a        location of a corresponding touch; and    -   optional “tap count” entry 348.

Thus, each touch data structure can define what is happening with arespective touch (or other input source) at a particular time (e.g.,whether the touch is stationary, being moved, etc.) as well as otherinformation associated with the touch (such as position). Accordingly,each touch data structure can define the state of a particular touch ata particular moment in time. One or more touch data structuresreferencing the same time can be added in a touch event data structurethat can define the states of all touches a particular view is receivingat a moment in time (as noted above, some touch data structures may alsoreference touches that have ended and are no longer being received).Multiple touch event data structures can be sent to the softwareimplementing a view as time passes, in order to provide the softwarewith continuous information describing the touches that are happening inthe view.

The ability to handle complex touch-based gestures, optionally includingmulti-touch gestures, can add complexity to the various softwareapplications. In some cases, such additional complexity can be necessaryto implement advanced and desirable interface features. For example, agame may require the ability to handle multiple simultaneous touchesthat occur in different views, as games often require the pressing ofmultiple buttons at the same time, or combining accelerometer data withtouches on a touch-sensitive surface. However, some simpler applicationsand/or views need not require advanced interface features. For example,a simple soft button (i.e., a button that is displayed on atouch-sensitive display) may operate satisfactorily with single touches,rather than multi-touch functionality. In these cases, the underlying OSmay send unnecessary or excessive touch data (e.g., multi-touch data) toa software component associated with a view that is intended to beoperable by single touches only (e.g., a single touch or tap on a softbutton). Because the software component may need to process this data,it may need to feature all the complexity of a software application thathandles multiple touches, even though it is associated with a view forwhich only single touches are relevant. This can increase the cost ofdevelopment of software for the device, because software components thathave been traditionally easy to program in a mouse interface environment(i.e., various buttons, etc.) may be much more complex in a multi-touchenvironment.

In order to reduce the complexity in recognizing complex touch-basedgestures, delegates can be used to control the behavior of eventrecognizers in accordance with some embodiments. As described below,delegates can determine, for example, whether a corresponding eventrecognizer (or gesture recognizer) can receive the event (e.g., touch)information; whether the corresponding event recognizer (or gesturerecognizer) can transition from an initial state (e.g., event possiblestate) of state machine to another state; and/or whether thecorresponding event recognizer (or gesture recognizer) cansimultaneously recognize the event (e.g., touch) as a correspondinggesture without blocking other event recognizer(s) (or gesturerecognizer(s)) from recognizing the event or getting blocked by otherevent recognizer(s) (or gesture recognizer(s)) recognizing the event.

It shall be understood, however, that the foregoing discussion regardingthe complexity of evaluating and processing user touches ontouch-sensitive surfaces also applies to all forms of user inputs tooperate electronic device 102 with input devices 128, not all of whichare initiated on touch screens, e.g., coordinating mouse movement andmouse button presses with or without single or multiple keyboard pressesor holds, device rotations or other movements, user movements such astaps, drags, scrolls, etc., on touch-pads, pen stylus inputs, oralinstructions, detected eye movements, biometric inputs, detectedphysiological change in a user, and/or any combination thereof, whichmay be utilized as inputs corresponding to events and/or sub-eventswhich define an event to be recognized.

Turning to the flow of event information, FIG. 3F is a block diagramillustrating the flow of event information in accordance with someembodiments. Event dispatcher module 315 (e.g., in operating system 118or application software 124) receives event information, and sends theevent information to one or more applications (e.g., 133-1 and 133-2).In some embodiments, application 133-1 includes a plurality of views(e.g., 508, 510, and 512 corresponding to views 317, FIG. 3D) in viewhierarchy 506 and a plurality of gesture recognizers (516-1 through516-3) in the plurality of views. Application 133-1 also includes one ormore gesture handlers 550, which correspond to the target values intarget-action pairs (e.g., 552-1 and 552-2). In some embodiments, eventdispatcher module 315 receives hit view information from hit viewdetermination module 314 and sends event information to the hit view(e.g., 512) or event recognizer(s) attached to the hit view (e.g., 516-1and 516-2). Additionally or alternatively, event dispatcher module 315receives hit level information from hit level determination module 352and sends event information to applications in the hit level (e.g.,133-1 and 133-2) or one or more event recognizers (e.g., 516-4) in thehit level applications. In some embodiments, one of the applicationsreceiving the event information is a default application (e.g., 133-2may be a default application). In some embodiments, only a subset ofgesture recognizers in each receiving application is allowed to (orconfigured to) receive the event information. For example, gesturerecognizer 516-3 in application 133-1 does not receive the eventinformation. The gesture recognizers that receive the event informationare called herein receiving gesture recognizers. In FIG. 3F, receivinggesture recognizers 516-1, 516-2, and 516-4 receive the eventinformation, and compare the received event information with arespective gesture definition 3037 (FIG. 3D) in the receiving gesturerecognizers. In FIG. 3F, gesture recognizers 516-1 and 516-4 haverespective gesture definitions that match the received eventinformation, and send respective action messages (e.g., 518-1 and 518-2)to corresponding gesture handlers (e.g., 552-1 and 552-3).

FIG. 4A depicts an event recognizer state machine 400 containing fourstates. By managing state transitions in event recognizer state machine400 based on received sub-events, an event recognizer effectivelyexpresses an event definition. For example, a tap gesture may beeffectively defined by a sequence of two, or optionally, threesub-events. First, a touch should be detected, and this will besub-event 1. For example, the touch sub-event may be a user's fingertouching a touch-sensitive surface in a view that includes the eventrecognizer having state machine 400. Second, an optional measured delaywhere the touch does not substantially move in any given direction(e.g., any movement of the touch position is less than a predefinedthreshold, which may be measured as a distance (e.g., 5 mm) or as anumber of pixels (e.g., 5 pixels) on the display), and the delay issufficiently short, would serve as sub-event 2. Finally, termination ofthe touch (e.g., liftoff of the user's finger from the touch-sensitivesurface) will serve as sub-event 3. By coding the event recognizer statemachine 400 to transition between states based upon receiving thesesub-events, the event recognizer state machine 400 effectively expressesa tap gesture event definition. However, it should be noted that thestates depicted in FIG. 4A are exemplary states, and an event recognizerstate machine 400 may contain more or fewer states and/or each state inthe event recognizer state machine 400 may correspond to one of thedepicted states or any other states.

In some embodiments, regardless of event type, the event recognizerstate machine 400 begins in an event recognition begins state 405, andmay progress to any of the remaining states depending on what sub-eventis received. To facilitate discussion of the event recognizer statemachine 400, the direct paths from the event recognition begins state405 to the event recognized state 415, the event possible state 410, andevent impossible state 420 will be discussed, followed by a descriptionof the paths leading from the event possible state 410.

Starting from event recognition begins state 405, if a sub-event isreceived that, by itself comprises the event definition for an event,the event recognizer state machine 400 will transition to eventrecognized state 415.

Starting from state event recognition begins 405, if a sub-event isreceived that is not the first sub-event in an event definition, theevent recognizer state machine 400 will transition to event impossiblestate 420.

Starting from event recognition begins state 405, if a sub-event isreceived that is the first and not final sub-event in a given eventdefinition, the event recognizer state machine 400 will transition toevent possible state 410. If the next sub-event received is a secondsub-event, but not the final sub-event in the given event definition,the event recognizer state machine 400 will remain in state eventpossible 410. The event recognizer state machine 400 can remain in stateevent possible 410 for as long as the sequence of received sub-eventscontinues to be part of the event definition. If, at any time the eventrecognizer state machine 400 is in event possible state 410, and theevent recognizer state machine 400 receives a sub-event that is not partof the event definition, it will transition to state event impossible420, thereby determining that the current event (if any) is not the typeof event that corresponds to this event recognizer (i.e., the eventrecognizer corresponding to state 400). If, on the other hand, the eventrecognizer state machine 400 is in the event possible state 410, and theevent recognizer state machine 400 receives the last sub-event in anevent definition, it will transition to the event recognized state 415,thereby completing a successful event recognition.

FIG. 4B depicts an embodiment of an input source handling process 440,having a finite state machine representing how views receive informationabout a respective input. It is noted that when there are multipletouches on the touch-sensitive surface of a device, each of the touchesis a separate input source having its own finite state machine. In thisembodiment, input source handling process 440 includes four states:input sequence begin 445, input sequence continues 450, input sequenceended 455, and input sequence cancelled 460. Input source handlingprocess 440 may be used by a respective event recognizer, for example,when input is to be delivered to an application, but only after thecompletion of an input sequence is detected. Input source handlingprocess 440 can be used with an application that is incapable ofcanceling or undoing changes made in response to an input sequencedelivered to the application. It should be noted that the statesdepicted in FIG. 4B are exemplary states, and input source handlingprocess 440 may contain more or fewer states and/or each state in inputsource handling process 440 may correspond to one of the depicted statesor any other states.

Starting from input sequence begin 445, if an input is received that, byitself completes an input sequence, input source handling process 440will transition to input sequence ended 455.

Starting from input sequence begin 445, if an input is received thatindicates the input sequence terminated, input source handling process440 will transition to input sequence cancelled 460.

Starting from input sequence begin 445, if an input is received that isthe first and not final input in a input sequence, input source handlingprocess 440 will transition to state input sequence continues 450. Ifthe next input received is the second input in an input sequence, theinput handling process 440 will remain in state input sequence continues450. Input source handling process 440 can remain in state inputsequence continues 450 for as long as the sequence of sub-events beingdelivered continue to be part of a given input sequence. If, at any timeinput source handling process 440 is in state input sequence continues450, and input source handling process 440 receives an input that is notpart of the input sequence, it will transition to state input sequencecancelled 460. If, on the other hand, input source handling process 440is in input sequence continues 450, and the input handling process 440receives the last input in a given input definition, it will transitionto the input sequence ended 455, thereby successfully receiving a groupof sub-events.

In some embodiments, input source handling process 440 may beimplemented for particular views or programmatic levels. In that case,certain sequences of sub-events may result in transitioning to stateinput cancelled 460.

As an example, consider FIG. 4C, which supposes an actively involvedview, represented only by actively involved view input source handler480 (hereafter “view 480”). View 480 includes a vertical swipe eventrecognizer, represented only by vertical swipe event recognizer 468(hereafter “recognizer 468”) as one of its event recognizers. In thiscase, the recognizer 468 may require as part of its definitiondetecting: 1) a finger down 465-1; 2) an optional short delay 465-2; 3),vertical swiping of at least N pixels 465-3; and 4) a finger liftoff465-4.

For this example, the recognizer 468 also has its delay touch began flag328 and touch cancellation flag 332 set. Now consider delivery of thefollowing sequence of sub-events to recognizer 468, as well as the view480:

-   -   sub-event sequence 465-1: detect finger down, which corresponds        to recognizer 468's event definition    -   sub-event sequence 465-2: measure delay, which corresponds to        recognizer 468's event definition    -   sub-event sequence 465-3: finger performs a vertical swiping        movement compatible with vertical scrolling, but is less than N        pixels, and therefore does not correspond to recognizer 468's        event definition    -   sub-event sequence 465-4: detect finger liftoff, which        corresponds to recognizer 468's event definition

Here, recognizer 468 would successfully recognize sub-events 1 and 2 aspart of its event definition, and accordingly, would be in state eventpossible 472 immediately prior to the delivery of sub-event 3. Sincerecognizer 468 has its delay touch began flag 328 set, the initial touchsub-event is not sent to the hit view. Correspondingly, the view 480'sinput source handling process 440 would still be in state input sequencebegin immediately prior to the delivery of sub-event 3.

Once delivery of sub-event 3 to recognizer 468 is complete, recognizer468's state transitions to event impossible 476, and importantly, therecognizer 468 has now determined that the sequence of sub-events doesnot correspond to its specific vertical swipe gesture event type (i.e.,it has decided the event is not a vertical swipe. In other words,recognition 474 as a vertical swipe does not occur in this example). Theinput source handling system 440 for view input source handler 480 willalso update its state. In some embodiments, the state of the view inputsource handler 480 would proceed from the input sequence begins state482 to the input sequence continues state 484 when the event recognizersends status information indicating that it has begun recognizing anevent. The view input source handler 480 proceeds to the input sequencecancelled state 488 when the touch or input ends without an event beingrecognized because the touch cancellation flag 322 of the eventrecognizer has been set. Alternately, if the touch cancellation flag 322of the event recognizer had not been set, the view input source handler480 proceeds to the input sequence ended state 486 when the touch ofinput ends.

Since event recognizer 468's touch cancellation flag 332 is set, whenthe event recognizer 468 transitions to the event impossible state 476,the recognizer will send a touch cancellation sub-event or message tothe hit view corresponding to the event recognizer. As a result, theview input source handler 480 will transition to the state inputsequence cancelled 488.

In some embodiments, delivery of sub-event 465-4 is not germane to anyevent recognition decisions made by recognizer 468, though view inputsource handler 480's other event recognizers, if any, may continue toanalyze the sequence of sub-events.

The following table presents in summarized tabular format the processingof this exemplary sub-event sequence 465 as related to the state ofevent recognizer 468 described above, along with the state of view inputsource handler 480. In this example, the state of the view input sourcehandler 480 proceeds from input sequence begin 445 to input sequencecancelled 488 because recognizer 468's touch cancellation flag 332 wasset:

Sub-Event Sequence 465 State: Recognizer 468 State: View 480 beforedelivery starts Event Recognition Begins 470 detect finger down EventPossible 472 Input Sequence 465-1 Begins 482 measure delay 465-2 EventPossible 472 Input Sequence Continues 484 detect finger vertical EventImpossible Input Sequence swipe 465-3 476 Continues 484 detect fingerliftoff Event Impossible Input Sequence 465-4 476 Cancelled 488

Turning to FIG. 5A, attention is directed to an example of a sub-eventsequence 520, which is being received by a view that includes aplurality of event recognizers. For this example, two event recognizersare depicted in FIG. 5A, scrolling event recognizer 580 and tap eventrecognizer 590. For purposes of illustration, the view search resultspanel 304 in FIG. 3A will be related to the reception of the sub-eventsequence 520, and the state transitions in scrolling event recognizer580 and tap event recognizer 590. Note that in this example, thesequence of sub-events 520 defines a tap finger gesture on atouch-sensitive display or trackpad, but the same event recognitiontechnique could be applied in a myriad of contexts, e.g., detecting amouse button press, and/or in embodiments utilizing programmatichierarchies of programmatic levels.

Before the first sub-event is delivered to view search results panel304, event recognizers 580 and 590 are in the event recognition beginsstates 582 and 592, respectively. Following touch 301, which isdelivered as sub-event detect finger down 521-1 to actively involvedevent recognizers for view search results panel 304 as touch sub-event301-2 (as well as to actively involved event recognizers for map view305 as touch sub-event 301-3), scrolling event recognizer 580transitions to state event possible 584, and similarly, tap eventrecognizer 590 transitions to state event possible 594. This is becausethe event definition of a tap and a scroll both begin with a touch suchas detecting a finger down on a touch-sensitive surface.

Some definitions of tap and scroll gestures may optionally include adelay between an initial touch and any next step in the eventdefinition. In all examples discussed here, the exemplar eventdefinitions for both tap and scroll gestures recognize a delay sub-eventfollowing the first touch sub-event (detect finger down).

Accordingly, as sub-event measure delay 521-2 is delivered to eventrecognizers 580 and 590, both remain in the event possible states 584and 594, respectively.

Finally, sub-event detect finger liftoff 521-3 is delivered to eventrecognizers 580 and 590. In this case, the state transitions for eventrecognizers 580 and 590 are different, because the event definitions fortap and scroll are different. In the case of scrolling event recognizer580, the next sub-event to remain in state event possible would be todetect movement. Since the sub-event delivered is detect finger liftoff521-3, however, the scrolling event recognizer 580 transitions to stateevent impossible 588. A tap event definition concludes with a fingerliftoff sub-event though. Accordingly, tap event recognizer 590transitions to state event recognized 596 after sub-event detect fingerliftoff 521-3 is delivered.

Note that in some embodiments, as discussed above with respect to FIGS.4B and 4C, the input source handling process 440 discussed in FIG. 4Bmay be used for various purposes at the view level. The following tablepresents in summarized tabular format the delivery of sub-event sequence520 as related to event recognizers 580, 590, and input source handlingprocess 440:

Sub-Event State: Scrolling State: Tap State: Input Sequence EventRecognizer Event Recognizer Source Handling 520 580 590 Process 440before delivery Event Recogni- Event Recogni- starts tion Begins 582tion Begins 592 Detect Finger Event Event Input Sequence Down 521-1Possible 584 Possible 594 Begin 445 Measure Event Event Input SequenceDelay 521-2 Possible 584 Possible 594 Continues 450 Detect Finger Eventimpossible Event Recognized Input Sequence Liftoff 521-3 588 596 Ended455

Turning to FIG. 5B, attention is directed to another example of asub-event sequence 530, which is being received by a view that includesa plurality of event recognizers. For this example, two eventrecognizers are depicted in FIG. 5B, scrolling event recognizer 580 andtap event recognizer 590. For purposes of illustration, the view searchresults panel 304 in FIG. 3A will be related to the reception of thesub-event sequence 530, and the state transitions in scrolling eventrecognizer 580 and tap event recognizer 590. Note that in this example,the sequence of sub-events 530 defines a scroll finger gesture on atouch-sensitive display, but the same event recognition technique couldbe applied in myriad contexts, e.g., detecting a mouse button press,mouse movement, and mouse button release, and/or in embodimentsutilizing programmatic hierarchies of programmatic levels.

Before the first sub-event is delivered to actively involved eventrecognizers for view search results panel 304, event recognizers 580 and590 are in the event recognition begins states 582 and 592,respectively. Following delivery of sub-events corresponding to touch301 (as discussed above), scrolling event recognizer 580 transitions tostate event possible 584, and similarly, tap event recognizer 590transitions to state event possible 594.

As sub-event measure delay 531-2 is delivered to event recognizers 580and 590, both transition to the event possible states 584 and 594,respectively.

Next, sub-event detect finger movement 531-3 is delivered to eventrecognizers 580 and 590. In this case, the state transitions for eventrecognizers 580 and 590 are different because the event definitions fortap and scroll are different. In the case of scrolling event recognizer580, the next sub-event to remain in state event possible is to detectmovement, so the scrolling event recognizer 580 remains in the eventpossible state 584 when it receives sub-event detect finger movement531-3. As discussed above, however, the definition for a tap concludeswith a finger liftoff sub-event, so tap event recognizer 590 transitionsto the state event impossible 598.

Finally, sub-event detect finger liftoff 531-4 is delivered to eventrecognizers 580 and 590. Tap event recognizer is already in the eventimpossible state 598, and no state transition occurs. Scrolling eventrecognizer 580's event definition concludes with detecting a fingerliftoff. Since the sub-event delivered is detect finger liftoff 531-4,the scrolling event recognizer 580 transitions to state event recognized586. It is noted that a finger movement on a touch sensitive surface maygenerate multiple movement sub-events, and therefore a scroll may berecognized before liftoff and continue until liftoff.

The following table presents in summarized tabular format the deliveryof sub-event sequence 530 as related to event recognizers 580, 590, andinput source handling process 440:

Sub-Event State: Scrolling State: Tap State: Input Sequence EventRecognizer Event Recognizer Source Handling 530 580 590 Process 440before delivery Event Recogni- Event Recogni- starts tion Begins 582tion Begins 592 detect finger Event Event Input Sequence down 531-1Possible 584 Possible 594 Begins 445 measure Event Event Input sequencedelay 531-2 Possible 584 Possible 594 continues 450 detect finger EventEvent Impossible Input sequence movement Possible 584 598 continues 450531-3 detect finger Event Recognized Event Impossible Input sequenceliftoff 531-4 586 598 ended 455

Turning to FIG. 5C, attention is directed to another example of asub-event sequence 540, which is being received by a view that includesa plurality of event recognizers. For this example, two eventrecognizers are depicted in FIG. 5C, double tap event recognizer 570 andtap event recognizer 590. For purposes of illustration, the map view 305in FIG. 3A will be related to the reception of the sub-event sequence540, and the state transitions in double tap event recognizer 570 andtap event recognizer 590. Note that in this example, the sequence ofsub-events 540 defines a double tap gesture on a touch-sensitivedisplay, but the same event recognition technique could be applied inmyriad contexts, e.g., detecting a mouse double click, and/or inembodiments utilizing programmatic hierarchies of programmatic levels.

Before the first sub-event is delivered to actively involved eventrecognizers for map view 305, event recognizers 570 and 590 are in theevent recognition begins states 572 and 592, respectively. Followingdelivery of sub-events related to touch sub-event 301 to map view 304(as described above), double tap event recognizer 570 and tap eventrecognizer 590 transition to states event possible 574 and 594,respectively. This is because the event definition of a tap and a doubletap both begin with a touch such as detecting a finger down 541-1 on atouch-sensitive surface.

As sub-event measure delay 541-2 is delivered to event recognizers 570and 590, both remain in states event possible 574 and 594, respectively.

Next, sub-event detect finger liftoff 541-3 is delivered to eventrecognizers 570 and 590. In this case, the state transitions for eventrecognizers 580 and 590 are different because the exemplar eventdefinitions for tap and double tap are different. In the case of tapevent recognizer 590, the final sub-event in the event definition is todetect finger liftoff, so the tap event recognizer 590 transitions tothe event recognized state 596.

Double tap recognizer 570 remains in state event possible 574, however,since a delay has begun, regardless of what the user may ultimately do.The complete event recognition definition for a double tap requiresanother delay, followed by a complete tap sub-event sequence though.This creates an ambiguous situation as between the tap event recognizer590, which is already in state event recognized 576, and the double taprecognizer 570, which is still in state event possible 574.

Accordingly, in some embodiments, event recognizers may implementexclusivity flags and exclusivity exception lists as discussed abovewith respect to FIGS. 3B and 3C. Here, the exclusivity flag 324 for tapevent recognizer 590 would be set, and additionally, exclusivityexception list 326 for tap event recognizer 590 would be configured tocontinue permitting delivery of sub-events to some event recognizers(such as double tap event recognizer 570) after tap event recognizer 590enters the state event recognized 596.

While tap event recognizer 590 remains in state event recognized 596,sub-event sequence 540 continues to be delivered to double tap eventrecognizer 570, where sub-events measure delay 541-4, detect finger down541-5, and measure delay 541-6, keep the double tap event recognizer 570in the state event possible 574; delivery of the final sub-event ofsequence 540, detect finger liftoff 541-7 transitions double tap eventrecognizer 570 to state event recognized 576.

At this point, the map view 305 takes the event double tap as recognizedby event recognizer 570, rather than the single tap event recognized bytap event recognizer 590. The decision to take the double tap event ismade in light of the combination of the tap event recognizer 590'sexclusivity flag 324 being set, the tap event recognizer 590'sexclusivity exception list 326 including a double tap event, and thefact that both the tap event recognizer 590 and the double tap eventrecognizer 570 both successfully recognized their respective eventtypes.

The following table presents in summarized tabular format the deliveryof sub-event sequence 540 as related to event recognizers 570 and 590,and sub-event handling process 440:

Sub-Event State: Double Tap State: Tap State: Input Sequence EventRecognizer Event Recognizer Source Handling 540 570 590 Process 440before delivery Event Recogni- Event Recogni- starts tion Begins 572tion Begins 592 detect finger Event Event Input Sequence down 541-1Possible 574 Possible 594 Begins 445 measure Event Event Input sequencedelay 541-2 Possible 574 Possible 594 continues 450 detect finger EventEvent Recognized Input sequence liftoff 541-3 Possible 574 596 continues450 measure Event Event Recognized Input sequence delay 541-4 Possible574 596 continues 450 detect finger Event Event Recognized Inputsequence down 541-5 Possible 574 596 continues 450 measure Event EventRecognized Input sequence delay 541-6 Possible 574 596 continues 450detect finger Event Recognized Event Recognized Input sequence liftoff541-7 576 596 ended 455

In another embodiment, in the event scenario of FIG. 5C, the single tapgesture is not recognized, because the single tap event recognizer has await-for list that identifies the double tap event recognizer. As aresult, a single tap gesture is not recognized until (if ever) thedouble tap event recognizer enters the event impossible state. In thisexample, in which a double tap gesture is recognized, the single tapevent recognizer would remain in the event possible state until thedouble tap gesture is recognized, at which point the single tap eventrecognizer would transition to the event impossible state.

Attention is now directed to FIGS. 6A and 6B, which are flow diagramsillustrating an event recognition method in accordance with someembodiments. The method 600 is performed at an electronic device, whichin some embodiments, may be an electronic device 102, as discussedabove. In some embodiments, the electronic device may include a touchsensitive surface configured to detect multi-touch gestures.Alternatively, the electronic device may include a touch screenconfigured to detect multi-touch gestures.

The method 600 is configured to execute software that includes a viewhierarchy with a plurality of views. The method 600 displays 608 one ormore views of the view hierarchy, and executes 610 one or more softwareelements. Each software element is associated with a particular view,and each particular view includes one or more event recognizers, such asthose described in FIGS. 3B and 3C as event recognizer structures 320and 360, respectively.

Each event recognizer generally includes an event definition based onone or more sub-events, where the event definition may be implemented asa state machine, see e.g., FIG. 3B state machine 340. Event recognizersalso generally include an event handler, which specifies an action for atarget, and is configured to send the action to the target in responseto the event recognizer detecting an event corresponding to the eventdefinition.

In some embodiments, at least one of the plurality of event recognizersis a gesture recognizer having a gesture definition and a gesturehandler as noted in step 612 of FIG. 6A.

In some embodiments, the event definition defines a user gesture asnoted in step 614 of FIG. 6A.

Alternatively, event recognizers have a set of event recognition states616. These event recognition states may include at least an eventpossible state, an event impossible state, and an event recognizedstate.

In some embodiments, the event handler initiates preparation 618 of itscorresponding action for delivery to the target if the event recognizerenters the event possible state. As discussed above with respect to FIG.4A and the examples in FIGS. 5A-5C, the state machines implemented foreach event recognizer generally include an initial state, e.g., stateevent recognition begins 405. Receiving a sub-event that forms theinitial part of an event definition triggers a state change to the eventpossible state 410. Accordingly, in some embodiments, as an eventrecognizer transitions from the state event recognition begins 405 tothe state event possible 410, the event recognizer's event handler maybegin preparing its particular action to deliver to the eventrecognizer's target after an event is successfully recognized.

On the other hand, in some embodiments, the event handler may terminatepreparation 620 of its corresponding action if the event recognizerenters the state event impossible 420. In some embodiments, terminatingthe corresponding action includes canceling any preparation of the eventhandler's corresponding action.

The example of FIG. 5B is informative for this embodiment since tapevent recognizer 590 may have initiated preparation 618 of its action,but then, once the sub-event detect finger movement 531-3 is deliveredto the tap event recognizer 590, the recognizer 590 will transition tothe event impossible state 598, 578. At that point, tap event recognizer590 may terminate preparation 620 of the action for which it hadinitiated preparation 618.

In some embodiments, the event handler completes preparation 622 of itscorresponding action for delivery to the target if the event recognizerenters the event recognized state. The example of FIG. 5C illustratesthis embodiment since a double tap is recognized by actively involvedevent recognizers for the map view 305, which in some implementations,would be the event bound to selecting and/or executing the search resultdepicted by map view 305. Here, after the double tap event recognizer570 successfully recognizes the double tap event comprised of thesub-event sequence 540, map view 305's event handler completespreparation 622 of its action, namely, indicating that it has receivedan activation command.

In some embodiments, the event handler delivers 624 its correspondingaction to the target associated with the event recognizer. Continuingwith the example of FIG. 5C, the action prepared, i.e. the activationcommand of the map view 305, would be delivered to the specific targetassociated with the map view 305, which may be any suitable programmaticmethod or object.

Alternatively, the plurality of event recognizers may independentlyprocess 626 the sequence of one or more sub-events in parallel.

In some embodiments, one or more event recognizers may be configured asexclusive event recognizers 628, as discussed above with respect toFIGS. 3B and 3C's exclusivity flags 324 and 364, respectively. When anevent recognizer is configured as an exclusive event recognizer, theevent delivery system prevents any other event recognizers for activelyinvolved views (except those listed in the exception list 326, 366 ofthe event recognizer that recognizes the event) in the view hierarchyfrom receiving subsequent sub-events (of the same sequence ofsub-events) after the exclusive event recognizer recognizes an event.Furthermore, when a non-exclusive event recognizer recognizes an event,the event delivery system prevents any exclusive event recognizers foractively involved views in the view hierarchy from receiving subsequentsub-events, except for those (if any) listed in the exception list 326,366 of the event recognizer that recognizes the event.

In some embodiments, exclusive event recognizers may include 630 anevent exception list, as discussed above with respect to FIGS. 3B and3C's exclusivity exception lists 326 and 366, respectively. As noted inthe discussion of FIG. 5C above, an event recognizer's exclusivityexception list can be used to permit event recognizers to continue withevent recognition even when the sequence of sub-events making up theirrespective event definitions overlap. Accordingly, in some embodiments,the event exception list includes events whose corresponding eventdefinitions have repetitive sub-events 632, such as the singletap/double tap event example of FIG. 5C.

Alternately, the event definition may define a user input operation 634.

In some embodiments, one or more event recognizers may be adapted todelay delivering every sub-event of the sequence of sub-events untilafter the event is recognized.

The method 600 detects 636 a sequence of one or more sub-events, and insome embodiments, the sequence of one or more sub-events may includeprimitive touch events 638. Primitive touch events may include, withoutlimitation, basic components of a touch-based gesture on atouch-sensitive surface, such as data related to an initial finger orstylus touch down, data related to initiation of multi-finger or stylusmovement across a touch-sensitive surface, dual finger movements inopposing directions, stylus lift off from a touch-sensitive surface,etc.

Sub-events in the sequence of one or more sub-events can include manyforms, including without limitation, key presses, key press holds, keypress releases, button presses, button press holds, button pressreleases, joystick movements, mouse movements, mouse button presses,mouse button releases, pen stylus touches, pen stylus movements, penstylus releases, oral instructions, detected eye movements, biometricinputs, and detected physiological changes in a user, among others.

The method 600 identifies 640 one of the views of the view hierarchy asa hit view. The hit view establishes which views in the view hierarchyare actively involved views. An example is depicted in FIG. 3A, wherethe actively involved views 303 include search results panel 304, andmaps view 305 because touch sub-event 301 contacted the area associatedwith the maps view 305.

In some embodiments, a first actively involved view within the viewhierarchy may be configured 642 to prevent delivery of the respectivesub-event to event recognizers associated with that first activelyinvolved view. This behavior can implement the skip property discussedabove with respect to FIGS. 3B and 3C (330 and 370, respectively). Whenthe skip property is set for an event recognizer, delivery of therespective sub-event is still performed for event recognizers associatedwith other actively involved views in the view hierarchy.

Alternately, a first actively involved view within the view hierarchymay be configured 644 to prevent delivery of the respective sub-event toevent recognizers associated with that first actively involved viewunless the first actively involved view is the hit view. This behaviorcan implement the conditional skip property discussed above with respectto FIGS. 3B and 3C (332 and 372, respectively).

In some embodiments, a second actively involved view within the viewhierarchy is configured 646 to prevent delivery of the respectivesub-event to event recognizers associated with the second activelyinvolved view and to event recognizers associated with ancestors of thesecond actively involved view. This behavior can implement the stopproperty discussed above with respect to FIGS. 3B and 3C (328 and 368,respectively).

The method 600 delivers 648 a respective sub-event to event recognizersfor each actively involved view within the view hierarchy. In someembodiments, event recognizers for actively involved views in the viewhierarchy process the respective sub-event prior to processing a nextsub-event in the sequence of sub-events. Alternately, event recognizersfor the actively involved views in the view hierarchy make theirsub-event recognition decisions while processing the respectivesub-event.

In some embodiments, event recognizers for actively involved views inthe view hierarchy may process the sequence of one or more sub-eventsconcurrently 650; alternatively, event recognizers for actively involvedviews in the view hierarchy may process the sequence of one or moresub-events in parallel.

In some embodiments, one or more event recognizers may be adapted todelay delivering 652 one or more sub-events of the sequence ofsub-events until after the event recognizer recognizes the event. Thisbehavior reflects a delayed event. For example, consider a single tapgesture in a view for which multiple tap gestures are possible. In thatcase, a tap event becomes a “tap+delay” recognizer. In essence, when anevent recognizer implements this behavior, the event recognizer willdelay event recognition until it is certain that the sequence ofsub-events does in fact correspond to its event definition. Thisbehavior may be appropriate when a recipient view is incapable ofappropriately responding to cancelled events. In some embodiments, anevent recognizer will delay updating its event recognition status to itsrespective actively involved view until the event recognizer is certainthat the sequence of sub-events does not correspond to its eventdefinition. As discussed above with respect to FIGS. 3B and 3C, delaytouch began flag 328, 368, delay touch end flag 330, 370, and touchcancellation flag 332, 372 are provided to tailor sub-event deliverytechniques, as well as event recognizer and view status informationupdates to specific needs.

FIGS. 7A-7S illustrate exemplary user interfaces and user inputsrecognized by event recognizers for navigating through concurrently openapplications in accordance with some embodiments. The user interfaces inthese figures are used to illustrate the processes described below,including the processes in FIGS. 8A-8B, FIGS. 9A-9C, and FIGS. 10A-10B.

Although many of the examples which follow will be given with referenceto inputs on touch screen display 156 (where the touch sensitive surfaceand the display are combined), in some embodiments, the device detectsinputs on a touch-sensitive surface that is separate from the display(e.g., a touchpad or trackpad). In some embodiments the touch-sensitivesurface has a primary axis that corresponds to a primary axis on thedisplay. In accordance with these embodiments, the device detectscontacts with the touch-sensitive surface at locations that correspondto respective locations on the display. In this way, user inputsdetected by the device on the touch-sensitive surface are used by thedevice to manipulate the user interface on the display of the electronicdevice when the touch-sensitive surface is separate from the display. Itshould be understood that similar methods may be used for other userinterfaces described herein.

FIG. 7A illustrates an exemplary user interface (“home screen” 708) onelectronic device 102 in accordance with some embodiments. Similar userinterfaces may be implemented on electronic devices 102. In someembodiments, home screen 708 is displayed by an application launchersoftware application, sometimes called a springboard. In someembodiments, the user interface on touch screen 156 includes thefollowing elements, or a subset or superset thereof:

-   -   Signal strength indicator(s) 702 for wireless communication(s),        such as cellular and Wi-Fi signals;    -   Time 704; and    -   Battery status indicator 706.

The exemplary user interface includes a plurality of application icons5002 (e.g., 5002-25 through 5002-38). From the home screen 708, a fingergesture can be used to launch an application. For example, tap fingergesture 701 at a location that corresponds to application icon 5002-36initiates launching an email application.

In FIG. 7B, in response to detecting the finger gesture 701 onapplication icon 5002-36, the email application is launched and emailapplication view 712-1 is displayed on touch screen 156. A user maylaunch other applications in a similar manner. For example, a user maypress home button 710 from any application view 712 to return to homescreen 708 (FIG. 7A), and launch other applications with finger gestureson respective application icons 5002 on home screen 708.

FIGS. 7C-7G illustrate that respective applications are sequentiallylaunched in response to detecting respective finger gestures atlocations corresponding to respective application icons 5002 on homescreen 708, and that respective user interfaces (i.e., respectiveapplication views) are displayed in turn. In particular, FIG. 7Cillustrates that media store application view 712-2 is displayed inresponse to a finger gesture on application icon 5002-32. In FIG. 7D,notes application view 712-3 is displayed in response to a fingergesture on application icon 5002-30. FIG. 7E illustrates that mapapplication view 712-4 is displayed in response to a finger gesture onapplication icon 5002-27. In FIG. 7F, weather application view 712-5 isdisplayed in response to a finger gesture on application icon 5002-28.FIG. 7G illustrates that web browser application view 712-6 is displayedin response to a finger gesture on application icon 5002-37. In someembodiments, a sequence of open applications corresponds to thelaunching of an email application, a media store application, a notesapplication, a map application, a weather application, and a web browserapplication.

FIG. 7G also illustrates a finger gesture 703 (e.g., a tap gesture) on auser interface object (e.g., a bookmark icon). In some embodiments, inresponse to detecting the finger gesture 703 on the bookmark icon, theweb browser application displays a list of bookmarks on touch screen156. Similarly, a user may interact with a displayed application (e.g.,the web browser application) with other gestures (e.g., a tap gesture onthe address user interface object, which allows the user to type in anew address or modify the displayed address, typically with an on-screenkeyboard; a tap gesture on any of links in the displayed web page, whichinitiates navigating to a web page corresponding to the selected link;etc.).

In FIG. 7G, a first predefined input (e.g., a double-click 705 on homebutton 710) is detected. Alternatively, a multi-finger swipe gesture(e.g., a three-finger swipe-up gesture as illustrated with movements offinger contacts 707, 709, and 711) is detected on touch screen 156.

FIG. 7H illustrates that, in response to detecting the first predefinedinput (e.g., double-click 705 or the multi-finger swipe gestureincluding finger contacts 707, 709, and 711), a portion of web browserapplication view 712-6 and application icon area 716 are concurrentlydisplayed. In some embodiments, in response to detecting the firstpredefined input, the device enters into an application view selectionmode for selecting one of the concurrently open applications, and theportion of web browser application view 712-6 and application icon area716 are concurrently displayed as part of the application view selectionmode. Application icon area 716 includes a group of open applicationicons that correspond to at least some of the plurality of concurrentlyopen applications. In this example, the portable electronic device hasmultiple applications that are concurrently open (e.g., the emailapplication, the media store application, the notes application, the mapapplication, the weather application, and the web browser application),although they are not all simultaneously displayed. As illustrated inFIG. 7H, application icon area 506 includes application icons (e.g.,5004-2, 5004-4, 5004-6, and 5004-8) for the weather application, the mapapplication, the notes application, and the media store application(i.e., four applications that immediately follow the currently displayedapplication, the web browser application, in the sequence of openapplications). In some embodiments, the sequence or order of openapplication icons displayed in application icon area 716 corresponds tothe sequence of open applications in the predetermined sequence (e.g.,weather, map, notes, and media store applications).

FIG. 7H also illustrates that gesture 713 (e.g., a tap gesture) isdetected on open application icon 5004-8. In some embodiments, inresponse to detecting gesture 713, a corresponding application view(e.g., media store application view 712-2, FIG. 7C) is displayed.

FIG. 7H illustrates that a left-swipe gesture 715 is detected at alocation corresponding to application icon area 716. In FIG. 7I, inresponse to detecting left-swipe gesture 715, the application icons(e.g., 5004-2, 5004-4, 5004-6, and 5004-8) in application icon area 716are scrolled. As a result of scrolling, application icon 5004-12 for theemail application is displayed in application icon area 506 instead ofpreviously displayed application icons (e.g., 5004-2, 5004-4, 5004-6,and 5004-8).

In FIG. 7J, a gesture of a first type (e.g., a multi-finger left-swipegesture including movements of finger contacts 717, 719, and 721) isdetected on web browser application view 712-6. FIG. 7K illustratesthat, in response to detecting the gesture of the first type, weatherapplication view 712-5 is displayed on touch screen 156. It should benoted that the weather application is next to the web browserapplication in the sequence of open applications.

FIG. 7K also illustrates that a second gesture of the first type (e.g.,a multi-finger left-swipe gesture including movements of finger contacts723, 725, and 727) is detected on weather application view 712-5. FIG.7L illustrates that, in response to detecting the second gesture of thefirst type, map application view 712-4 is displayed on touch screen 156.It should be noted that the map application is next to the weatherapplication in the sequence of open applications.

FIG. 7L also illustrates that a third gesture of the first type (e.g., amulti-finger left-swipe gesture including movements of finger contacts729, 731, and 733) is detected on map application view 712-4. FIG. 7Millustrates that, in response to detecting the third gesture of thefirst type, notes application view 712-3 is displayed on touch screen156. It should be noted that the notes application is next to the mapapplication in the sequence of open applications.

FIG. 7M also illustrates that a fourth gesture of the first type (e.g.,a multi-finger left-swipe gesture including movements of finger contacts735, 737, and 739) is detected on notes application view 712-3. FIG. 7Nillustrates that, in response to detecting the fourth gesture of thefirst type, media store application view 712-2 is displayed on touchscreen 156. It should be noted that the media store application is nextto the notes application in the sequence of open applications.

FIG. 7N also illustrates that a fifth gesture of the first type (e.g., amulti-finger left-swipe gesture including movements of finger contacts741, 743, and 745) is detected on media store application view 712-2.FIG. 7O illustrates that, in response to detecting the fifth gesture ofthe first type, email application view 712-1 is displayed on touchscreen 156. It should be noted that the email application is next to themedia store application in the sequence of open applications.

FIG. 7O also illustrates that a sixth gesture of the first type (e.g., amulti-finger left-swipe gesture including movements of finger contacts747, 749, and 751) is detected on email application view 712-1. FIG. 7Pillustrates that, in response to detecting the sixth gesture of thefirst type, web browser application view 712-6 is displayed on touchscreen 156. It should be noted that the web browser application is onone end of the sequence of open applications, and the email applicationis on the opposite end of the sequence of open applications.

FIG. 7P also illustrates that a gesture of a second type (e.g., amulti-finger right-swipe gesture including movements of finger contacts753, 755, and 757) is detected on web browser application view 712-6.FIG. 7Q illustrates that, in some embodiments, in response to detectingthe gesture of the second type, email application view 712-1 isdisplayed on touch screen 156.

Referring to FIG. 7R, a multi-finger gesture (e.g., a five-finger pinchgesture including movements of finger contacts 759, 761, 763, 765, and767) is detected on web browser application view 712-6. FIG. 7Sillustrates that, while detecting the multi-finger gesture on touchscreen 156, web browser application view 712-6 and at least a portion ofhome screen 708 are concurrently displayed. As illustrated, web browserapplication view 712-6 is displayed at a reduced scale. The reducedscale is adjusted in accordance with the multi-finger gesture while themulti-finger gesture is detected on the touch screen 156. For example,the reduced scale decreases with further pinching of finger contacts759, 761, 763, 765, and 767 (i.e., web browser application view 712-6 isdisplayed at a smaller scale). Alternatively, the reduced scaleincreases with depinching of finger contacts 759, 761, 763, 765, and 767(i.e., web browser application view 712-6 is displayed at a larger scalethan before).

In some embodiments, when the multi-finger gesture ceases to bedetected, web browser application view 712-6 ceases to be displayed, andthe entire home screen 708 is displayed. Alternatively, when themulti-finger gesture ceases to be detected, it is determined whether theentire home screen 708 is to be displayed or web browser applicationview 712-6 is to be displayed at a full-screen scale. In someembodiments, the determination is made based on the reduced scale whenthe multi-finger gesture ceases to be displayed (e.g., if theapplication view is displayed at a scale smaller than a predefinedthreshold when the multi-finger gesture ceases to be detected, theentire home screen 708 is displayed; if the application view isdisplayed at a scale larger than the predefined threshold when themulti-finger gesture ceases to be detected, the application view isdisplayed at a full-screen scale without a display of home screen 708).In some embodiments, the determination is made also based on the speedof the multi-finger gesture.

FIGS. 8A and 8B are flow diagrams illustrating event recognition method800 in accordance with some embodiments. Method 800 is performed (802)at an electronic device with a touch-sensitive display (e.g., device102, FIG. 1B). The electronic device is configured to execute at least afirst software application and a second software application. The firstsoftware application includes a first set of one or more gesturerecognizers, and the second software application includes one or moreviews and a second set of one or more gesture recognizers (e.g.,application 133-2 has gesture recognizer 516-4, and application 133-1has gesture recognizers 516-1 through 516-3 and views 508, 510, and 512,FIG. 3F). Respective gesture recognizers have corresponding gesturehandlers (e.g., gesture handler 552-1 corresponds to gesture recognizer516-1 and gesture handler 552-3 corresponds to gesture recognizer516-4). The first set of one or more gesture recognizers is typicallydifferent from the second set of one or more gesture recognizers.

Method 800 allows a user to control with a gesture a hidden openapplication that is not currently displayed on a display of theelectronic device (e.g., the first software application), such as abackground application, a suspended application, or a hibernatedapplication. Thus, the user can perform operations that are not providedby the application currently displayed on the display of the electronicdevice (e.g., the second software application) but are provided by oneof the currently open applications (e.g., displaying a home screen orswitching to a next software application using gestures for a hiddenapplication launcher software application).

In some embodiments, the first software application is (804) anapplication launcher (e.g., a springboard). For example, as shown inFIG. 7A, the application launcher displays a plurality of applicationicons 5002 that correspond to a plurality of applications. Theapplication launcher receives a user-selection of an application icon5002 (e.g., based on a finger gesture on touch screen 156), and inresponse to receiving the user-selection, launches an applicationcorresponding to the selected application icon 5002.

The second software application is typically a software applicationlaunched by the application launcher. As illustrated in FIGS. 7A and 7B,the application launcher receives information about tap gesture 701 onemail application icon 5002-36, and launches an email application. Inresponse, the email application displays email application view 712-1 ontouch screen 156. The second application may be any application thatcorresponds to application icons 5002 (FIG. 7A) or any other applicationthat can be launched by the application launcher (e.g., media storeapplication, FIG. 7C; notes application, FIG. 7D; map application, FIG.7E; weather application, 7F; web browser application, FIG. 7G; etc.). Inthe following description of method 800, an application launcher is usedas an exemplary first software application and a web browser applicationis used as an exemplary second software application.

In some embodiments, the electronic device has only two softwareapplications in the programmatic hierarchy: an application launcher andone other software application (typically a software applicationcorresponding to one or more views displayed on touch screen 156 ofelectronic device 102).

In some embodiments, the first software application is (806) anoperating system application. As used herein, an operating systemapplication refers to an application that is integrated with anoperating system 118 (FIGS. 1A-1C). An operating system applicationtypically resides in core OS level 208 or operating system API software206 in FIG. 2 . An operating system application is typically notremovable by a user, whereas other applications typically may beinstalled or removed by the user. In some embodiments, the operatingsystem application includes the application launcher. In someembodiments, the operating system application includes a settingsapplication (e.g., an application for displaying/modifying systemsettings or one or more values in device/global internal state 134, FIG.1C). In some embodiments, the operating system application includesaccessibility module 127. In some embodiments, the electronic device hasonly three software applications in the programmatic hierarchy: anapplication launcher, a settings application, and one other application(typically a software application corresponding to one or more viewsdisplayed on touch screen 156 of electronic device 102).

The electronic device displays (808) at least a subset of the one ormore views of the second software application (e.g., web browserapplication view 712-6, FIG. 7G).

In some embodiments, the displaying includes (810) displaying at least asubset of the one or more views of the second software applicationwithout displaying any view of the first software application. Forexample, in FIG. 7G, no view of the application launcher (e.g., homescreen 708) is displayed.

In some embodiments, the displaying includes (812) displaying at least asubset of the one or more views of the second software applicationwithout displaying a view of any other application. For example, in FIG.7G, only one or more views of the web browser application are displayed.

While displaying at least the subset of the one or more views of thesecond software application, the electronic device detects (814) asequence of touch inputs on the touch-sensitive display (e.g., gesture703, which includes a touch-down event and a touch-up event; or anothergesture, which includes touch-down of finger contacts 707, 709, and 711,movements of finger contacts 707, 709, and 711 across touch screen 156,and lift-off of finger contacts 707, 709, and 711). The sequence oftouch inputs includes a first portion of one or more touch inputs and asecond portion of one or more touch inputs subsequent to the firstportion. As used herein, the term “sequence” refers to the order inwhich one or more touch events happens. For example, in the sequence oftouch inputs including finger contacts 707, 709, and 711, the firstportion may include the touch-down of finger contacts 707, 709, and 711,and the second portion may include the movements of finger contacts 707,709, and 711, and lift-off of finger contacts 707, 709, and 711.

In some embodiments, the detecting occurs (816) while touch inputs inthe first portion of one or more touch inputs at least partially overlapat least one of the displayed views of the second software application.In some embodiments, even though the touch inputs at least partiallyoverlap at least one of the displayed views of the second softwareapplication, the first software application receives the first portionof one or more touch inputs. For example, the application launcherreceives the first portion of touch inputs on the displayed views of theweb browser (FIG. 7G), even though the application launcher is notdisplayed.

During a first phase of detecting the sequence of touch inputs (818),the electronic device delivers (820) the first portion of one or moretouch inputs to the first software application and the second softwareapplication (e.g., using event dispatcher module 315, FIG. 3D),identifies (822) from gesture recognizers in the first set, one or morematching gesture recognizers that recognize the first portion of one ormore touch inputs (e.g., using event comparator 3033 in each gesturerecognizer (typically, each receiving gesture recognizer) in the firstset, FIG. 3D), and processes (824) the first portion of one or moretouch inputs with one or more gesture handlers corresponding to the oneor more matching gesture recognizers (e.g., activating correspondingevent handler(s) 319, FIG. 3D).

In some embodiments, the first phase of detecting the sequence of touchinputs is a phase of detecting the first portion of one or more touchinputs.

Regarding the delivering operation (820), in some embodiments, the firstsoftware application, after receiving the first portion of one or moreinputs, delivers the first portion of one or more touch inputs to atleast a subset of gesture recognizers in the first set, and the secondsoftware application, after receiving the first portion of one or moreinputs, delivers the first portion of one or more touch inputs to atleast a subset of gesture recognizers in the second set. In someembodiments, the electronic device or an event dispatcher module (e.g.,315, FIG. 3D) in the electronic device delivers the first portion of oneor more touch inputs to at least a subset of gesture recognizers in thefirst set and the second set (e.g., event dispatcher module 315 deliversthe first portion of one or more touch inputs to gesture recognizers516-1, 516-2, and 516-4, FIG. 3F).

For example, when the finger gesture including finger contacts 707, 709,and 711 is detected on touch screen 156 (FIG. 7G), the touch-down eventis delivered to one or more gesture recognizers of the applicationlauncher and one or more gesture recognizers of the web browserapplication. In another example, a touch-down event of tap gesture 703(FIG. 7G) is delivered to one or more gesture recognizers of theapplication launcher and one or more gesture recognizers of the webbrowser application.

In some embodiments, when no gesture recognizer in the first setrecognizes the first portion of one or more touch inputs (e.g., amismatch between detected events and the gesture definition or thegesture is not completed), processing the first portion of one or moretouch inputs includes performing a null operation (e.g., the device doesnot update the displayed user interface).

In some embodiments, the electronic device identifies from gesturerecognizers in the second set, one or more matching gesture recognizersthat recognizer the first portion of one or more touch inputs. Theelectronic device processes the first portion of one or more touchinputs with one or more gesture handlers corresponding to the one ormore matching gesture recognizers. For example, in response to tapgesture 703 (FIG. 7G) delivered to one or more gesture recognizers ofthe web browser application, a matching gesture recognizer in the webbrowser application (e.g., a gesture recognizer that recognizes a tapgesture on the bookmark icon, FIG. 7G) processes tap gesture 703 bydisplaying a list of bookmarks on touch screen 156.

In some embodiments, during a second phase of detecting the sequence oftouch inputs, subsequent to the first phase, the electronic devicedelivers (826, FIG. 8B) the second portion of one or more touch inputsto the first software application without delivering the second portionof one or more touch inputs to the second software application (e.g.,using event dispatcher module 315, FIG. 3D), identifies from the one ormore matching gesture recognizers a second matching gesture recognizerthat recognizes the sequence of touch inputs (e.g., using eventcomparator 3033 in each matching gesture recognizer, FIG. 3D), andprocesses the sequence of touch inputs with a gesture handlercorresponding to the respective matching gesture recognizer. In someembodiments, the second phase of detecting the sequence of touch inputsis a phase of detecting the second portion of one or more touch inputs.

For example, when the finger gesture including finger contacts 707, 709,and 711 is detected on touch screen 156 (FIG. 7G), the touch movementand lift-off events are delivered to one or more gesture recognizers ofthe application launcher without delivering the touch events to the webbrowser application. The electronic device identifies a matching gesturerecognizer (e.g., a three-finger swipe-up gesture recognizer) of theapplication launcher, and processes the sequence of touch inputs with agesture handler corresponding to the three-finger swipe-up gesturerecognizer.

The second software application does not receive the second portion ofone or more touch inputs during the second phase, typically because thefirst software application has a priority over the second softwareapplication (e.g., in the programmatic hierarchy). Thus, in someembodiments, when a gesture recognizer in the first software applicationrecognizes the first portion of one or more touch inputs, the one ormore gesture recognizers in the first software application exclusivelyreceive the second subsequent portion of one or more touch inputs. Inaddition, the second software application may not receive the secondportion of one or more touch inputs during the second phase, because nogesture recognizer in the second software application matches the firstportion of one or more touch inputs.

In some embodiments, processing the sequence of touch inputs with thegesture handler corresponding to the respective matching gesturerecognizer includes (834) displaying in a first predefined area of thetouch-sensitive display a group of open application icons thatcorrespond to at least some of a plurality of concurrently openapplications, and concurrently displaying at least a subset of the oneor more views of the second software application. For example, in FIG.7H, application icons 5004 in predefined area 716 corresponds toconcurrently open applications of the electronic device. In someembodiments, application icons 5004 in predefined area 716 are displayedin accordance with a sequence of open applications. In FIG. 7H, theelectronic device concurrently displays predefined area 716 and a subsetof web browser application view 712-6.

In some embodiments, processing the sequence of touch inputs with thegesture handler corresponding to the respective matching gesturerecognizer includes (828) displaying one or more views of the firstsoftware application. For example, in response to a multi-finger pinchgesture (FIG. 7R), the electronic device displays home screen 708 (FIG.7A). In some embodiments, displaying the one or more views of the firstsoftware application includes displaying the one or more views of thefirst software application without concurrently displaying a viewcorresponding to any other software application (e.g., FIG. 7A).

In some embodiments, processing the sequence of touch inputs with thegesture handler corresponding to the respective matching gesturerecognizer includes (830) replacing the display of the one or more viewsof the second software application with display of one or more views ofthe first software application (e.g., displaying home screen 708, FIG.7A). Thus, the one or more views of the second software applicationceases to be displayed after the one or more views of the first softwareapplication are displayed. In some embodiments, replacing the display ofthe one or more views of the second software application with display ofone or more views of the first software application includes displayingthe one or more views of the first software application withoutconcurrently displaying a view corresponding to any other softwareapplication (FIG. 7A).

In some embodiments, the electronic device concurrently executes (832)the first software application, the second software application, and athird software application. In some embodiments, processing the sequenceof touch inputs with the gesture handler corresponding to the respectivematching gesture recognizer includes replacing the one or more displayedviews of the second software application with one or more views of thethird software application. For example, in response to a multi-fingerswipe gesture, the electronic device replaces the display of web browserapplication view 712-6 with a display of weather application view 712-5(FIGS. 7J-7K). In some embodiments, replacing the one or more displayedviews of the second software application with one or more views of thethird software application includes displaying the one or more views ofthe third software application without concurrently displaying a viewcorresponding to any other software application. In some embodiments,the third software application is next to the second softwareapplication in the sequence of open applications.

In some embodiments, processing the sequence of touch inputs with thegesture handler corresponding to the respective matching gesturerecognizer includes launching a settings application. For example, inresponse to a ten-finger tap gesture, the electronic device launches thesettings application.

Note that details of the processes described above with respect tomethod 800 are also applicable in an analogous manner to method 900described below. For brevity, these details are not repeated below.

FIGS. 9A-9C are flow diagrams illustrating event recognition method 900in accordance with some embodiments. Method 900 is performed (902) at anelectronic device with a touch-sensitive display. The electronic deviceis configured to execute at least a first software application and asecond software application. The first software application includes afirst set of one or more gesture recognizers, and the second softwareapplication includes one or more views and a second set of one or moregesture recognizers. Respective gesture recognizers have correspondinggesture handlers. In some embodiments, the first set of one or moregesture recognizers is different from the second set of one or moregesture recognizers.

Method 900 allows a user to control with a gesture a hidden openapplication that is not currently displayed on a display of theelectronic device (e.g., the first software application), such as abackground application, a suspended application, or a hibernatedapplication Thus, the user can perform operations that are not providedby the application currently displayed on the display of the electronicdevice (e.g., the second software application) but are provided by oneof the currently open applications (e.g., displaying a home screen orswitching to a next software application using gestures for a hiddenapplication launcher software application).

In some embodiments, the first software application is (904) anapplication launcher (e.g., a springboard). In some embodiments, thefirst software application is (906) an operating system application. Inthe following description of method 900, an application launcher is usedas an exemplary first software application and a web browser applicationis used as an exemplary second software application.

The electronic device displays (908) a first set of one or more views(e.g., web browser application view 712-6, FIG. 7G). The first set ofone or more views includes at least a subset of the one or more views ofthe second software application. For example, the second softwareapplication may have a plurality of application views (e.g., applicationviews 317 of application 133-1, FIG. 3D), and the electronic devicedisplays at least one view of the plurality of application views. Insome embodiments, the subset includes the entire one or more views ofthe second software application.

In some embodiments, displaying the first set of one or more viewsincludes (910) displaying the first set of one or more views withoutdisplaying any view of the first software application (e.g., web browserapplication view 712-6, FIG. 7G).

In some embodiments, displaying the first set of one or more viewsincludes (912) displaying the first set of one or more views withoutdisplaying a view of any other software application. For example, inFIG. 7G, only one or more views of the web browser application aredisplayed.

While displaying the first set of the one or more views, the electronicdevice detects (914) a sequence of touch inputs on the touch-sensitivedisplay, and determines (920) whether at least one gesture recognizer inthe first set of one or more gesture recognizers recognizes the firstportion of one or more touch inputs. For example, while displaying webbrowser application view 712-6 (FIG. 7G), the device determines whethergesture recognizers for the application launcher recognizes the firstportion of the touch inputs. The sequence of touch inputs includes afirst portion of one or more touch inputs and a second portion of one ormore touch inputs subsequent to the first portion (i.e., the secondportion is after the first portion).

In some embodiments, the sequence of touch inputs at least partiallyoverlaps (916) at least one of the one or more displayed views of thesecond software application. For example, the application launcherreceives the first portion of touch inputs on web browser applicationview 712-6 (FIG. 7G), even though the application launcher is notdisplayed.

In some embodiments, prior to a determination that at least one gesturerecognizer in the first set of one or more gesture recognizersrecognizes the first portion of one or more touch inputs, the electronicdevice concurrently delivers (918) the first portion of one or moretouch inputs to the first software application and the second softwareapplication. For example, both the application launcher and the webbrowser application receive the touch-down event of finger contacts 707,709, and 711 (FIG. 7G) prior to a determination that at least onegesture recognizer in the application launcher recognizes the touch-downevent.

In accordance with a determination that at least one gesture recognizerin the first set of one or more gesture recognizers recognizes the firstportion of one or more touch inputs (922, FIG. 9B), the electronicdevice delivers (924) the sequence of touch inputs to the first softwareapplication without delivering the sequence of touch inputs to thesecond software application, determines (926) whether at least onegesture recognizer in the first set of one or more gesture recognizersrecognizes the sequence of touch inputs, and in accordance with adetermination that at least one gesture recognizer in the first set ofone or more gesture recognizers recognizes the sequence of touch inputs,processes (928) the sequence of touch inputs with the at least onegesture recognizer in the first set of one or more gesture recognizersthat recognizes the sequence of touch inputs.

For example, when the touch-down and touch-movement of three fingercontacts 707, 709, and 711 are detected on touch screen 156 (FIG. 7G),the electronic device identifies that at least a three-finger swipe-upgesture recognizer of the application launcher recognizes the touchinputs. Thereafter, the electronic device delivers subsequent touchevents (e.g., lift-off of finger contact 707, 709, and 711) to theapplication launcher without delivering the subsequent touch events tothe web browser application. The electronic device further identifiesthat the three-finger swipe-up gesture recognizer recognizes thesequence of touch inputs, and processes the sequence of touch inputswith a gesture handler corresponding to the three-finger swipe-upgesture recognizer.

In some embodiments, processing the sequence of touch inputs with the atleast one gesture recognizer in the first set of one or more gesturerecognizers includes (930) displaying one or more views of the firstsoftware application. For example, in response to detecting amulti-finger pinch gesture (FIG. 7R), the electronic device displayshome screen 708 (FIG. 7A).

In some embodiments, processing the sequence of touch inputs with the atleast one gesture recognizer in the first set of one or more gesturerecognizers includes (932) replacing the display of the first set of oneor more views with display of one or more views of the first softwareapplication (e.g., displaying home screen 708, FIG. 7A, which is part ofthe application launcher software application).

In some embodiments, the electronic device concurrently executes thefirst software application, the second software application, and a thirdsoftware application; and processing the sequence of touch inputs withthe at least one gesture recognizer in the first set of one or moregesture recognizers includes (934) replacing the first set of one ormore views with one or more views of the third software application. Insome embodiments, replacing the first set of one or more views with oneor more views of the third software application includes displaying theone or more views of the third software application without concurrentlydisplaying a view corresponding to any other software application. Forexample, in response to a multi-finger swipe gesture, the electronicdevice replaces the display of web browser application view 712-6 with adisplay of weather application view 712-5 (FIGS. 7J-7K).

In some embodiments, processing the sequence of touch inputs with the atleast one gesture recognizer in the first set of one or more gesturerecognizers includes (936) displaying in a first predefined area of thetouch-sensitive display a group of open application icons thatcorrespond to at least some of a plurality of concurrently openapplications, and concurrently displaying at least a subset of the firstset of one or more views. For example, in FIG. 7H, application icons5004 in predefined area 716 corresponds to concurrently openapplications of the electronic device. In some embodiments, applicationicons 5004 in predefined area 716 are displayed in accordance with asequence of open applications. In FIG. 7H, the electronic deviceconcurrently displays predefined area 716 and a subset of web browserapplication view 712-6.

In accordance with a determination that no gesture recognizer in thefirst set of one or more gesture recognizers recognizes the firstportion of one or more touch inputs (938, FIG. 9C), the electronicdevice delivers (940) the sequence of touch inputs to the secondsoftware application, determines (942) whether at least one gesturerecognizer in the second set of one or more gesture recognizersrecognizes the sequence of touch inputs, and in accordance with adetermination that at least one gesture recognizer in the second set ofone or more gesture recognizers recognizes the sequence of touch inputs,processes (944) the sequence of touch inputs with the at least onegesture recognizer in the second set of one or more gesture recognizersthat recognizes the sequence of touch inputs.

For example, when the first portion of one or more touch inputs is tapgesture (e.g., 703, FIG. 7G), and no gesture recognizer in theapplication launcher recognizes the tap gesture, the electronic devicedelivers the tap gesture to the web browser application, and determineswhether at least one gesture recognizer of the web browser applicationrecognizes the tap gesture. When the web browser application (or agesture recognizer of the web browser application) recognizes tapgesture 703 on the bookmark icon, the electronic device processes tapgesture 703 with a corresponding gesture handler.

FIGS. 10A-10B are flow diagrams illustrating an event recognition methodin accordance with some embodiments. Note that details of the processesdescribed above with respect to methods 600, 800, and 900 are alsoapplicable in an analogous manner to method 1000 described below. Forbrevity, these details are not repeated below.

Method 1000 is performed (1002) at an electronic device with an internalstate (e.g., device/global internal state 134, FIG. 1C). The electronicdevice is configured to execute software that includes a view hierarchywith a plurality of views.

In method 1000, at least one gesture recognizer has a plurality ofgesture definitions. This helps the gesture recognizer work in differentdistinct operating modes. For example, a device may have a normaloperating mode and an accessibility operating mode. In the normaloperating mode, a next application gesture is used to move betweenapplications, and the next application gesture is defined as athree-finger left-swipe gesture. In the accessibility operating mode,the three-finger left-swipe gesture is used to perform a differentfunction. Thus, a gesture different from the three-finger left-swipe isneeded in the accessibility operating mode to correspond to the nextapplication gesture (e.g., a four-finger left-swipe gesture in theaccessibility operating mode). By having multiple gesture definitionsassociated with the next application gesture, the device can select oneof the gesture definitions for the next application gesture, dependingon the current operating mode. This provides flexibility in using thegesture recognizer in different operating modes. In some embodiments, aplurality of gesture recognizers with multiple gesture definitions isadjusted depending on the operating mode (e.g., gestures performed withthree fingers in the normal operating mode are performed with fourfingers in the accessibility operating mode).

In some embodiments, the internal state includes (1016) one or moresettings for an accessibility operating mode (e.g., the internal stateindicates whether the device is operating in the accessibility operatingmode).

In some embodiments, the software is (1018) or includes an applicationlauncher (e.g., a springboard).

In some embodiments, the software is (1020) or includes an operatingsystem application (e.g., an application integrated with an operatingsystem of the device).

The electronic device displays (1004) one or more views of the viewhierarchy.

The electronic device executes (1006) one or more software elements.Each software element is associated with a particular view (e.g.,application 133-1 has one or more application views 317, FIG. 3D), andeach particular view includes one or more event recognizers (e.g., eventrecognizers 325, FIG. 3D). Each event recognizer has one or more eventdefinitions based on one or more sub-events, and an event handler (e.g.,gesture definitions 3035 and a reference to a corresponding eventhandler in event delivery information 3039, FIG. 3D). The event handlerspecifies an action for a target, and is configured to send the actionto the target in response to the event recognizer detecting an eventcorresponding to a particular event definition of the one or more eventdefinitions (e.g., an event definition selected from the one or moreevent definitions when the event recognizer has multiple eventdefinitions, or a sole event definition when the event recognizer hasonly one event definition).

The electronic device detects (1008) a sequence of one or moresub-events.

The electronic device identifies (1010) one of the views of the viewhierarchy as a hit view. The hit view establishes which views in theview hierarchy are actively involved views.

The electronic device delivers (1012) a respective sub-event to eventrecognizers for each actively involved view within the view hierarchy.In some embodiments, the one or more actively involved views in the viewhierarchy include the hit view. In some embodiments, the one or moreactively involved views in the view hierarchy include a default view(e.g., home screen 708 of the application launcher).

At least one event recognizer for actively involved views in the viewhierarchy has (1014) a plurality of event definitions, one of which isselected in accordance with the internal state of the electronic device.For example, event recognizer 325-1 has a plurality of gesturedefinitions (e.g., 3037-1 and 3037-2, FIG. 3D). In some embodiments,event recognizer 325-1 selects one of the plurality of gesturedefinitions in event recognizer 325-1 based on one or more values indevice/global internal state 134 (FIG. 1C). The at least one eventrecognizer then processes the respective sub-event prior to processing anext sub-event in the sequence of sub-events in accordance with theselected event definition. In some embodiments, each of two or moreevent recognizers for actively involved views in the view hierarchy hasa plurality of event definitions, one of which is selected in accordancewith the internal state of the electronic device. In such embodiments,at least one of the two or more event recognizers processes therespective sub-event prior to processing the next sub-event in thesequence of sub-events in accordance with the selected event definition.

For example, FIGS. 7J-7K illustrate a next-application gesture thatinitiates displaying an application view of a next application. In someembodiments, the application launcher includes a next-applicationgesture recognizer, which includes a gesture definition that matches athree-finger left-swipe gesture. For purposes of this example, assumethat the next-application gesture recognizer also includes a gesturedefinition that corresponds to a four-finger left-swipe gesture. Whenone or more values in device/global internal state 134 are set todefault value(s), the next-application gesture recognizer uses thethree-finger left-swipe gesture definition and does not use thefour-finger left-swipe gesture definition. When the one or more valuesin device/global internal state 134 are modified (e.g., by usingaccessibility module 127, FIG. 1C), the next-application gesturerecognizer uses the four-finger left-swipe gesture definition and doesnot use the three-finger left-swipe gesture definition. Thus, in thisexample, when the one or more values in device/global internal state 134are modified, a four-finger left-swipe gesture initiates displaying anapplication view of a next application.

Similarly, FIGS. 7R-7S illustrate that a home screen gesture initiatesdisplaying web browser application view 712-6 at a reduced scale anddisplaying at least a portion of home screen 708 in response todetecting a five-finger pinch gesture. Based on device/global internalstate 134 and gesture definitions in a home screen gesture recognizer, afour-finger pinch gesture, a three-finger pinch gesture, or any othersuitable gesture may be used to initiate displaying web-browserapplication view 712-6 at a reduced scale and displaying at least aportion of home screen 708.

In some embodiments, the plurality of event definitions includes (1020)a first event definition corresponding to a first swipe gesture with afirst number of fingers and a second event definition corresponding to asecond swipe gesture with a second number of fingers distinct from thefirst number of fingers. For example, the plurality of event definitionsfor a respective gesture recognizer may include a three-finger swipegesture and a four-finger swipe gesture.

In some embodiments, the plurality of event definitions includes a firstevent definition corresponding a first gesture of a first kind with afirst number of fingers and a second event definition corresponding to asecond gesture of the first kind with a second number of fingersdistinct from the first number of fingers (e.g., a one-finger tapgesture and a two-finger tap gesture, a two-finger pinch gesture and athree-finger pinch gesture, etc.).

In some embodiments, the plurality of event definitions includes a firstevent definition corresponding to a first gesture and a second eventdefinition corresponding to a second gesture distinct from the firstgesture (e.g., a swipe gesture and a pinch gesture, a swipe gesture anda tap gesture, etc.).

In some embodiments, a respective definition of the plurality of eventdefinitions is selected (1022) for a respective event recognizer inaccordance with the internal state of the electronic device and adetermination (by the electronic device) that the respective eventdefinition does not correspond to an event definition of any eventrecognizer for the actively involved views other than the respectiveevent recognizer.

For example, a respective gesture recognizer may have two eventdefinitions: a first event definition corresponding to a three-fingerleft swipe gesture that is typically used for a normal operating modeand a second event definition corresponding to a four-finger left swipegesture that is typically used for an accessibility operating mode. Whenthe internal state of the electronic device is set in a way such thatthe electronic device operates in the accessibility mode, the electronicdevice determines whether the four-finger left swipe gesture for thesecond event definition is used by any other event recognizer for theactively involved views. If the four-finger left swipe gesture is notused by any other event recognizer for the actively involved views, thefour-finger left swipe gesture is selected for the respective gesturerecognizer in the accessibility operating mode. On the other hand, ifthe four-finger left swipe gesture is used by any other event recognizerfor the actively involved views, the three-finger left swipe gesture isused for the respective gesture recognizer even in the accessibilityoperating mode. This prevents two or more gesture recognizers fromundesirably responding to a same gesture.

In some embodiments, a respective definition of the plurality of eventdefinitions is selected for a respective event recognizer in accordancewith the internal state of the electronic device and a determination (bythe electronic device) that the respective event definition does notcorrespond to an event definition of any event recognizer (includingevent recognizers for the actively involved views and any other views)other than the respective event recognizer.

In some embodiments, two or more event recognizers for actively involvedviews in the view hierarchy each have (1024) a respective plurality ofevent definitions, and a respective event definition of the respectiveplurality of event definitions is selected for a respective eventrecognizer in accordance with the internal state of the electronicdevice and a determination (by the electronic device) that therespective event definition does not correspond to any event definitionselected for any event recognizer with two or more event definitionsother than the respective event recognizer.

For example, actively involved views may have a first gesture recognizerand a second gesture recognizer. In this example, the first gesturerecognizer has: a first event definition corresponding to a three-fingerleft swipe gesture that is typically used for a normal operating modeand a second event definition corresponding to a four-finger left swipegesture that is typically used for an accessibility operating mode. Thesecond gesture recognizer has: a third event definition corresponding toa two-finger left swipe gesture that is typically used for the normaloperating mode and a fourth event definition corresponding to thefour-finger left swipe gesture that is typically used for theaccessibility operating mode. When the internal state of the electronicdevice is set in a way such that the electronic device operates in theaccessibility mode, the electronic device determines whether afour-finger left swipe gesture that satisfies the second eventdefinition is selected for any other event recognizer with two or moreevent definitions (e.g., the second event gesture recognizer). If thefour-finger left swipe gesture is not selected for any other eventrecognizer with two or more event definitions, the four-finger leftswipe gesture is selected for the first gesture recognizer in theaccessibility operating mode. As a result, the four-finger left swipegesture is not selected for the second gesture recognizer, because thefour-finger left swipe gesture is already selected for the first gesturerecognizer. Instead, the two-finger left swipe gesture is selected forthe second gesture recognizer, because the two-finger left swipe gestureis not selected for any other gesture recognizer with two or more eventdefinitions including the first gesture recognizer. In another example,the actively involved views have the first gesture recognizer and athird gesture recognizer without the second gesture recognizer. Thethird gesture recognizer has the third event definition (correspondingto the two-finger left swipe gesture) that is typically used for thenormal operating mode and a fifth event definition corresponding to athree-finger left swipe gesture that is typically used for theaccessibility operating mode. In the accessibility operating mode, thethree-finger left swipe gesture can be selected for the third gesturerecognizer, because the three-finger left swipe gesture is not selectedfor any other gesture recognizer with two or more event definitions.

Although the examples above have been described with respect tomulti-finger left swipe gestures, the methods described above apply toswipe gestures in any direction (e.g., a swipe-right gesture, swipe-upgesture, swipe-down gesture, and/or any diagonal swipe gesture) orgestures of any other kinds (e.g., tap gestures, pinch gestures, depinchgestures, etc.).

In some embodiments, processing the respective sub-event in accordancewith the selected event definition includes (1026) displaying one ormore views of a first software application distinct from the softwarethat includes the view hierarchy (e.g., concurrently displaying at leasta portion of user interface 712-6 including one or more views of thesoftware and a portion of home screen 708, FIG. 7S).

In some embodiments, the at least one event recognizer processes (1028)the respective sub-event by replacing the display of the one or moreviews of the view hierarchy with display of one or more views of a firstsoftware application (e.g., home screen 708, FIG. 7A) distinct from thesoftware that includes the view hierarchy.

In some embodiments, the at least one event recognizer processes (1030)the respective sub-event by: displaying in a first predefined area of adisplay in the electronic device a group of open application icons thatcorrespond to at least some of a plurality of concurrently openapplications; and concurrently displaying at least a subset of the oneor more views of the view hierarchy (e.g., open application icons 5004and at least a portion of user interface 712-6, FIG. 7H). For example,the electronic device concurrently displays the group of openapplication icons and at least a subset of the one or more views of theview hierarchy in response to a three-finger swipe-up gesture in thenormal operating mode and a four-finger swipe-up gesture in theaccessibility operating mode.

In accordance with some embodiments, FIG. 11 shows a functional blockdiagram of an electronic device 1100 configured in accordance with theprinciples of the invention as described above. The functional blocks ofthe device may be implemented by hardware, software, or a combination ofhardware and software to carry out the principles of the invention. Itis understood by persons of skill in the art that the functional blocksdescribed in FIG. 11 may be combined or separated into sub-blocks toimplement the principles of the invention as described above. Therefore,the description herein may support any possible combination orseparation or further definition of the functional blocks describedherein.

As shown in FIG. 11 , an electronic device 1100 includes atouch-sensitive display unit 1102 configured to receive touch inputs;and a processing unit 1106 coupled to the touch-sensitive display unit1102. In some embodiments, the processing unit 1106 includes anexecuting unit 1108, a display enabling unit 1110, a detecting unit1112, a delivering unit 1114, an identifying unit 1116, and a touchinput processing unit 1118.

The processing unit 1106 is configured to: execute at least a firstsoftware application and a second software application (e.g., with theexecuting unit 1108). The first software application includes a firstset of one or more gesture recognizers, and the second softwareapplication includes one or more views and a second set of one or moregesture recognizers. Respective gesture recognizers have correspondinggesture handlers. The processing unit 1106 is configured to enabledisplay of at least a subset of the one or more views of the secondsoftware application (e.g., with the display enabling unit 1110, on thetouch-sensitive display unit 1102). The processing unit 1106 isconfigured to, while displaying at least the subset of the one or moreviews of the second software application: detect a sequence of touchinputs on the touch-sensitive display unit 1102 (e.g., with thedetecting unit 1112). The sequence of touch inputs includes a firstportion of one or more touch inputs and a second portion of one or moretouch inputs subsequent to the first portion. The processing unit 1106is configured to, during a first phase of detecting the sequence oftouch inputs: deliver the first portion of one or more touch inputs tothe first software application and the second software application(e.g., with the delivering unit 1114); identify from gesture recognizersin the first set one or more matching gesture recognizers that recognizethe first portion of one or more touch inputs (e.g., with theidentifying unit 1116); and process the first portion of one or moretouch inputs with one or more gesture handlers corresponding to the oneor more matching gesture recognizers (e.g., with the touch inputprocessing unit 1118).

In some embodiments, the processing unit 1106 is configured to detectthe sequence of touch inputs (e.g., with the detecting unit 1112) whiletouch inputs in the first portion of one or more touch inputs at leastpartially overlap at least one of the displayed views of the secondsoftware application.

In some embodiments, the processing unit 1106 is configured to enabledisplay of at least a subset of the one or more views of the secondsoftware application without displaying any view of the first softwareapplication (e.g., with the display enabling unit 1110, on thetouch-sensitive display unit 1102).

In some embodiments, the processing unit 1106 is configured to enabledisplay of at least a subset of the one or more views of the secondsoftware application without displaying a view of any other application(e.g., with the display enabling unit 1110, on the touch-sensitivedisplay unit 1102).

In some embodiments, the processing unit 1106 is configured to, during asecond phase of detecting the sequence of touch inputs, subsequent tothe first phase: deliver the second portion of one or more touch inputsto the first software application without delivering the second portionof one or more touch inputs to the second software application (e.g.,with the delivering unit 1114); identify from the one or more matchinggesture recognizers a second matching gesture recognizer that recognizesthe sequence of touch inputs (e.g., with the identifying unit 1116); andprocess the sequence of touch inputs with a gesture handlercorresponding to the respective matching gesture recognizer (e.g., withthe touch input processing unit 1118).

In some embodiments, the processing unit 1106 is configured to processthe sequence of touch inputs with the gesture handler corresponding tothe respective matching gesture recognizer by enabling display of one ormore views of the first software application (e.g., with the displayenabling unit 1110, on the touch-sensitive display unit 1102).

In some embodiments, the processing unit 1106 is configured to processthe sequence of touch inputs with the gesture handler corresponding tothe respective matching gesture recognizer by replacing the display ofthe one or more views of the second software application with display ofone or more views of the first software application (e.g., with thedisplay enabling unit 1110, on the touch-sensitive display unit 1102).

In some embodiments, the processing unit 1106 is configured to:concurrently execute the first software application, the second softwareapplication, and a third software application (e.g., with the executingunit 1108); and process the sequence of touch inputs with the gesturehandler corresponding to the respective matching gesture recognizer byreplacing the one or more displayed views of the second softwareapplication with one or more views of the third software application(e.g., with the display enabling unit 1110, on the touch-sensitivedisplay unit 1102).

In some embodiments, the processing unit 1106 is configured to: enabledisplay of, in a first predefined area of the touch-sensitive displayunit 1102, a group of open application icons that correspond to at leastsome of a plurality of concurrently open applications (e.g., with thedisplay enabling unit 1110); and enable concurrent display of at least asubset of the one or more views of the second software application(e.g., with the display enabling unit 1110).

In some embodiments, the first software application is an applicationlauncher.

In some embodiments, the first software application is an operatingsystem application.

In accordance with some embodiments, FIG. 12 shows a functional blockdiagram of an electronic device 1200 configured in accordance with theprinciples of the invention as described above. The functional blocks ofthe device may be implemented by hardware, software, or a combination ofhardware and software to carry out the principles of the invention. Itis understood by persons of skill in the art that the functional blocksdescribed in FIG. 12 may be combined or separated into sub-blocks toimplement the principles of the invention as described above. Therefore,the description herein may support any possible combination orseparation or further definition of the functional blocks describedherein.

As shown in FIG. 12 , an electronic device 1200 includes atouch-sensitive display unit 1202 configured to receive touch inputs;and a processing unit 1206 coupled to the touch-sensitive display unit1202. In some embodiments, the processing unit 1206 includes anexecuting unit 1208, a display enabling unit 1210, a detecting unit1212, a determining unit 1214, a delivering unit 1216, and a touch inputprocessing unit 1218.

The processing unit 1206 is configured to execute at least a firstsoftware application and a second software application (e.g., with theexecuting unit 1208). The first software application includes a firstset of one or more gesture recognizers, and the second softwareapplication includes one or more views and a second set of one or moregesture recognizers. Respective gesture recognizers have correspondinggesture handlers. The processing unit 1206 is configured to enabledisplay of a first set of one or more views (e.g., with the displayenabling unit 1210). The first set of one or more views include at leasta subset of the one or more views of the second software application.The processing unit 1206 is configured to, while displaying the firstset of the one or more views, detect a sequence of touch inputs on thetouch-sensitive display unit (e.g., with the detecting unit 1212). Thesequence of touch inputs includes a first portion of one or more touchinputs and a second portion of one or more touch inputs subsequent tothe first portion. The processing unit 1206 is configured to determinewhether at least one gesture recognizer in the first set of one or moregesture recognizers recognizes the first portion of one or more touchinputs (e.g., with the determining unit 1214). The processing unit 1206is configured to, in accordance with a determination that at least onegesture recognizer in the first set of one or more gesture recognizersrecognizes the first portion of one or more touch inputs: deliver thesequence of touch inputs to the first software application withoutdelivering the sequence of touch inputs to the second softwareapplication (e.g., with the delivering unit 1216); determine whether atleast one gesture recognizer in the first set of one or more gesturerecognizers recognizes the sequence of touch inputs (e.g., with thedetermining unit 1214). The processing unit 1206 is configured to, inaccordance with a determination that at least one gesture recognizer inthe first set of one or more gesture recognizers recognizes the sequenceof touch inputs, process the sequence of touch inputs with the at leastone gesture recognizer in the first set of one or more gesturerecognizers that recognizes the sequence of touch inputs (e.g., with thetouch input processing unit 1218). The processing unit 1206 isconfigured to, in accordance with a determination that no gesturerecognizer in the first set of one or more gesture recognizersrecognizes the first portion of one or more touch inputs: deliver thesequence of touch inputs to the second software application (e.g., withthe delivering unit 1216); and determine whether at least one gesturerecognizer in the second set of one or more gesture recognizersrecognizes the sequence of touch inputs (e.g., with the determining unit1214). The processing unit 1206 is configured to, in accordance with adetermination that at least one gesture recognizer in the second set ofone or more gesture recognizers recognizes the sequence of touch inputs,process the sequence of touch inputs with the at least one gesturerecognizer in the second set of one or more gesture recognizers thatrecognizes the sequence of touch inputs (e.g., with the touch inputprocessing unit 1218).

In some embodiments, the sequence of touch inputs at least partiallyoverlaps at least one of the one or more displayed views of the secondsoftware application.

In some embodiments, the processing unit 1206 is configured to enabledisplay of the first set of one or more views without displaying anyview of the first software application (e.g., with the display enablingunit 1210, on the touch-sensitive display unit 1202).

In some embodiments, the processing unit 1206 is configured to enabledisplay of the first set of one or more views without displaying a viewof any other software application (e.g., with the display enabling unit1210, on the touch-sensitive display unit 1202).

In some embodiments, prior to the determination that at least onegesture recognizer in the first set of one or more gesture recognizersrecognizes the first portion of one or more touch inputs, the processingunit 1206 is configured to concurrently deliver the first portion of oneor more touch inputs to the first software application and the secondsoftware application (e.g., with the delivering unit 1216).

In some embodiments, the first software application is an applicationlauncher.

In some embodiments, the first software application is an operatingsystem application.

In some embodiments, the processing unit 1206 is configured to processthe sequence of touch inputs with the at least one gesture recognizer inthe first set of one or more gesture recognizers by enabling displayingone or more views of the first software application (e.g., with thedisplay enabling unit 1208, on the touch-sensitive display unit 1202).

In some embodiments, the processing unit 1206 is configured to processthe sequence of touch inputs with the at least one gesture recognizer inthe first set of one or more gesture recognizers by replacing thedisplay of the first set of one or more views with display of one ormore views of the first software application (e.g., with the displayenabling unit 1208, on the touch-sensitive display unit 1202).

In some embodiments, the processing unit 1206 is configured toconcurrently execute the first software application, the second softwareapplication, and a third software application (e.g., with the executingunit 1208). The processing unit 1206 is configured to process thesequence of touch inputs with the at least one gesture recognizer in thefirst set of one or more gesture recognizers by replacing the first setof one or more views with one or more views of the third softwareapplication (e.g., with the display enabling unit 1210, on thetouch-sensitive display unit 1202).

In some embodiments, the processing unit 1206 is configured to: enabledisplay of in a first predefined area of the touch-sensitive displayunit 1202 a group of open application icons that correspond to at leastsome of a plurality of concurrently open applications (e.g., with thedisplay enabling unit 1210); and concurrently display at least a subsetof the first set of one or more views (e.g., with the display enablingunit 1210).

In accordance with some embodiments, FIG. 13 shows a functional blockdiagram of an electronic device 1300 configured in accordance with theprinciples of the invention as described above. The functional blocks ofthe device may be implemented by hardware, software, or a combination ofhardware and software to carry out the principles of the invention. Itis understood by persons of skill in the art that the functional blocksdescribed in FIG. 13 may be combined or separated into sub-blocks toimplement the principles of the invention as described above. Therefore,the description herein may support any possible combination orseparation or further definition of the functional blocks describedherein.

As shown in FIG. 13 , an electronic device 1300 includes a display unit1302 configured to display one or more views; a memory unit 1304configured to store an internal state; and a processing unit 1306coupled to the display unit 1302 and the memory unit 1304. In someembodiments, the processing unit 1306 includes an executing unit 1308, adisplay enabling unit 1310, a detecting unit 1312, an identifying unit1314, a delivering unit 1316, and an event/sub-event processing unit1318. In some embodiments, the processing unit 1306 includes the memoryunit 1304.

The processing unit 1306 is configured to: execute software thatincludes a view hierarchy with a plurality of views (e.g., with theexecuting unit 1308); enable display of one or more views of the viewhierarchy (e.g., with the display enabling unit 1310, on the displayunit 1302); and execute one or more software elements (e.g., with theexecuting unit 1308). Each software element is associated with aparticular view, and each particular view includes one or more eventrecognizers. Each event recognizer has: one or more event definitionsbased on one or more sub-events, and an event handler. The event handlerspecifies an action for a target, and is configured to send the actionto the target in response to the event recognizer detecting an eventcorresponding to a particular event definition of the one or more eventdefinitions. The processing unit 1306 is configured to: detect asequence of one or more sub-events (e.g., with the detecting unit 1312);and identify one of the views of the view hierarchy as a hit view (e.g.,with the identifying unit 1314). The hit view establishes which views inthe view hierarchy are actively involved views. The processing unit 1306is configured to deliver a respective sub-event to event recognizers foreach actively involved view within the view hierarchy (e.g., with thedelivering unit 1316). At least one event recognizer for activelyinvolved views in the view hierarchy has a plurality of eventdefinitions, one of which is selected in accordance with the internalstate of the electronic device, and the at least one event recognizerprocesses the respective sub-event (e.g., with the event/sub-eventprocessing unit 1318) prior to processing a next sub-event in thesequence of sub-events in accordance with the selected event definition.

In some embodiments, the plurality of event definitions includes a firstevent definition corresponding to a first swipe gesture with a firstnumber of fingers and a second event definition corresponding to asecond swipe gesture with a second number of fingers distinct from thefirst number of fingers.

In some embodiments, the internal state includes one or more settingsfor an accessibility operating mode.

In some embodiments, a respective definition of the plurality of eventdefinitions is selected for a respective event recognizer in accordancewith the internal state of the electronic device and a determinationthat the respective event definition does not correspond to an eventdefinition of any event recognizer for the actively involved views otherthan the respective event recognizer.

In some embodiments, two or more event recognizers for actively involvedviews in the view hierarchy each have a respective plurality of eventdefinitions, and a respective event definition of the respectiveplurality of event definitions is selected for a respective eventrecognizer in accordance with the internal state of the electronicdevice and a determination that the respective event definition does notcorrespond to any event definition selected for any event recognizerwith two or more event definitions other than the respective eventrecognizer.

In some embodiments, the processing unit 1306 is configured to processthe respective sub-event in accordance with the selected eventdefinition by enabling display of one or more views of a first softwareapplication distinct from the software that includes the view hierarchy(e.g., with the display enabling unit 1310, on the display unit 1302).

In some embodiments, the processing unit 1306 is configured to processthe respective sub-event by replacing the display of the one or moreviews of the view hierarchy with display of one or more views of a firstsoftware application distinct from the software that includes the viewhierarchy (e.g., with the display enabling unit 1310, on the displayunit 1302).

In some embodiments, the processing unit 1306 is configured to processthe respective sub-event by: enabling display of, in a first predefinedarea of the display unit 1302, a group of open application icons thatcorrespond to at least some of a plurality of concurrently openapplications (e.g., with the display enabling unit 1310); and enablingconcurrently display of at least a subset of the one or more views ofthe view hierarchy (e.g., with the display enabling unit 1310).

In some embodiments, the software is an application launcher.

In some embodiments, the software is an operating system application.

The foregoing description, for purpose of explanation, has beendescribed with reference to specific embodiments. However, theillustrative discussions above are not intended to be exhaustive or tolimit the invention to the precise forms disclosed. Many modificationsand variations are possible in view of the above teachings. Theembodiments were chosen and described in order to best explain theprinciples of the invention and its practical applications, to therebyenable others skilled in the art to best utilize the invention andvarious embodiments with various modifications as are suited to theparticular use contemplated.

What is claimed is:
 1. A method comprising: at an electronic device witha touch-sensitive display: displaying, by the electronic device, on thetouch-sensitive display, a user interface of a first softwareapplication; while displaying the user interface of the first softwareapplication, detecting, by the electronic device, one or more firsttouch inputs on a region of the touch-sensitive display that includesthe user interface of the first software application; and in response todetecting the one or more first touch inputs: in accordance with adetermination that the one or more first touch inputs correspond to asystem gesture for switching applications, replacing, by the electronicdevice, display of the user interface of the first software applicationwith display of a user interface of a second software applicationwithout delivering information corresponding to the one or more firsttouch inputs to the first software application, wherein the secondsoftware application is different from the first software application;and in accordance with a determination that the one or more first touchinputs do not correspond to a system gesture, delivering, by theelectronic device, the information corresponding to the one or morefirst touch inputs to the first software application.
 2. The method ofclaim 1, wherein, in accordance with the determination that the one ormore first touch inputs do not correspond to a system gesture, the firstsoftware application performs an operation in response to theinformation corresponding to the one or more first touch inputs beingdelivered to the first software application.
 3. The method of claim 2,including processing the one or more first touch inputs using one ormore gesture recognizers of the first software application and one ormore system gesture recognizers to determine whether the one or morefirst touch inputs correspond to the system gesture for switchingapplications.
 4. The method of claim 1, including processing the one ormore first touch inputs using one or more system gesture recognizers todetermine whether the one or more first touch inputs correspond to thesystem gesture for switching applications.
 5. The method of claim 4,wherein the one or more system gesture recognizers are associated withan operating system that is different from the first softwareapplication.
 6. The method of claim 1, including, prior to detecting theone or more first touch inputs, displaying the user interface of thefirst software application without concurrently displaying the userinterface of the second software application.
 7. The method of claim 1,wherein replacing display of the user interface of the first softwareapplication with display of the user interface of the second softwareapplication includes ceasing to display the user interface of the firstsoftware application.
 8. The method of claim 1, wherein the secondsoftware application is a next software application following the firstsoftware application in a sequence of applications with retained stateinformation.
 9. The method of claim 1, including: while displaying theuser interface of the second software application, detecting one or moresecond touch inputs on a region of the touch-sensitive display thatincludes the user interface of the second software application; and inresponse to detecting the one or more second touch inputs: in accordancewith a determination that the one or more second touch inputs correspondto the system gesture for switching applications, replacing display ofthe user interface of the second software application with display of auser interface of a third software application without deliveringinformation corresponding to the one or more second touch inputs to thesecond software application; and in accordance with a determination thatthe one or more second touch inputs do not correspond to a systemgesture, delivering the information corresponding to the one or moresecond touch inputs to the second software application.
 10. The methodof claim 9, wherein the second software application is a next softwareapplication following the first software application in a sequence ofapplications with retained state information, and the third softwareapplication is a next software application following the second softwareapplication in the sequence of applications with retained stateinformation.
 11. The method of claim 9, wherein determining that the oneor more first touch inputs correspond to the system gesture forswitching applications includes determining that the one or more firsttouch inputs correspond to the system gesture for switching applicationsperformed in a first direction, and wherein: in accordance with adetermination that the one or more second touch inputs correspond to thesystem gesture for switching applications performed in the firstdirection, the third software application is different from the firstsoftware application; and in accordance with a determination that theone or more second touch inputs correspond to the system gesture forswitching applications performed in a second direction that is oppositethe first direction, the third software application is the firstsoftware application.
 12. The method of claim 11, wherein: the systemgesture for switching applications performed in the first directionincludes a swipe gesture in the first direction; and the system gesturefor switching applications performed in the second direction includes aswipe gesture in the second direction that is opposite the firstdirection.
 13. The method of claim 1, wherein determining that the oneor more first touch inputs correspond to the system gesture forswitching applications includes determining that the one or more firsttouch inputs correspond to a first type of system gesture for switchingapplications, and the method includes: in response to detecting the oneor more first touch inputs: in accordance with a determination that theone or more first touch inputs correspond to a second type of systemgesture for switching applications, replacing display of at least aportion of the user interface of the first software application with auser interface of an operating system without delivering informationcorresponding to the one or more first touch inputs to the firstsoftware application, wherein the operating system is different from thefirst software application and from the second software application. 14.The method of claim 13, wherein: determining that the one or more firsttouch inputs correspond to the first type of system gesture forswitching applications includes determining that the one or more firsttouch inputs include a swipe gesture in a first direction; anddetermining that the one or more first touch inputs correspond to thesecond type of system gesture for switching applications includesdetermining that the one or more first touch inputs include a swipegesture in a second direction that is perpendicular to the firstdirection.
 15. The method of claim 13, wherein: determining that the oneor more first touch inputs correspond to the first type of systemgesture for switching applications includes determining that the one ormore first touch inputs include a swipe gesture; and determining thatthe one or more first touch inputs correspond to the second type ofsystem gesture for switching applications includes determining that theone or more first touch inputs include a pinch gesture.
 16. The methodof claim 1, wherein: in accordance with a determination that theelectronic device is operating in a first mode: determining that the oneor more first touch inputs correspond to the system gesture forswitching applications includes determining that the one or more firsttouch inputs match a first gesture definition for the system gesture forswitching applications; and in accordance with a determination that theelectronic device is operating in a second mode: determining that theone or more first touch inputs correspond to the system gesture forswitching applications includes determining that the one or more firsttouch inputs match a second gesture definition for the system gesturefor switching applications, wherein the second gesture definition isdifferent from the first gesture definition.
 17. An electronic device,comprising: a touch-sensitive display; one or more processors; andmemory storing one or more programs for execution by the one or moreprocessors, the one or more programs including instructions for:displaying, by the electronic device, on the touch-sensitive display, auser interface of a first software application; while displaying theuser interface of the first software application, detecting, by theelectronic device, one or more first touch inputs on a region of thetouch-sensitive display that includes the user interface of the firstsoftware application; and in response to detecting the one or more firsttouch inputs: in accordance with a determination that the one or morefirst touch inputs correspond to a system gesture for switchingapplications, replacing, by the electronic device, display of the userinterface of the first software application with display of a userinterface of a second software application without deliveringinformation corresponding to the one or more first touch inputs to thefirst software application, wherein the second software application isdifferent from the first software application; and in accordance with adetermination that the one or more first touch inputs do not correspondto a system gesture, delivering, by the electronic device, theinformation corresponding to the one or more first touch inputs to thefirst software application.
 18. The electronic device of claim 17,wherein, in accordance with the determination that the one or more firsttouch inputs do not correspond to a system gesture, the first softwareapplication performs an operation in response to the informationcorresponding to the one or more first touch inputs being delivered tothe first software application.
 19. The electronic device of claim 18,wherein the one or more programs include instructions for processing theone or more first touch inputs using one or more gesture recognizers ofthe first software application and one or more system gesturerecognizers to determine whether the one or more first touch inputscorrespond to the system gesture for switching applications.
 20. Theelectronic device of claim 17, wherein the one or more programs includeinstructions for processing the one or more first touch inputs using oneor more system gesture recognizers to determine whether the one or morefirst touch inputs correspond to the system gesture for switchingapplications.
 21. The electronic device of claim 20, wherein the one ormore system gesture recognizers are associated with an operating systemthat is different from the first software application.
 22. Theelectronic device of claim 17, wherein the one or more programs includeinstructions for, prior to detecting the one or more first touch inputs,displaying the user interface of the first software application withoutconcurrently displaying the user interface of the second softwareapplication.
 23. The electronic device of claim 17, wherein replacingdisplay of the user interface of the first software application withdisplay of the user interface of the second software applicationincludes ceasing to display the user interface of the first softwareapplication.
 24. The electronic device of claim 17, wherein the secondsoftware application is a next software application following the firstsoftware application in a sequence of applications with retained stateinformation.
 25. The electronic device of claim 17, wherein the one ormore programs include instructions for: while displaying the userinterface of the second software application, detecting one or moresecond touch inputs on a region of the touch-sensitive display thatincludes the user interface of the second software application; and inresponse to detecting the one or more second touch inputs: in accordancewith a determination that the one or more second touch inputs correspondto the system gesture for switching applications, replacing display ofthe user interface of the second software application with display of auser interface of a third software application without deliveringinformation corresponding to the one or more second touch inputs to thesecond software application; and in accordance with a determination thatthe one or more second touch inputs do not correspond to a systemgesture, delivering the information corresponding to the one or moresecond touch inputs to the second software application.
 26. Theelectronic device of claim 25, wherein the second software applicationis a next software application following the first software applicationin a sequence of applications with retained state information, and thethird software application is a next software application following thesecond software application in the sequence of applications withretained state information.
 27. The electronic device of claim 25,wherein determining that the one or more first touch inputs correspondto the system gesture for switching applications includes determiningthat the one or more first touch inputs correspond to the system gesturefor switching applications performed in a first direction, and wherein:in accordance with a determination that the one or more second touchinputs correspond to the system gesture for switching applicationsperformed in the first direction, the third software application isdifferent from the first software application; and in accordance with adetermination that the one or more second touch inputs correspond to thesystem gesture for switching applications performed in a seconddirection that is opposite the first direction, the third softwareapplication is the first software application.
 28. The electronic deviceof claim 27, wherein: the system gesture for switching applicationsperformed in the first direction includes a swipe gesture in the firstdirection; and the system gesture for switching applications performedin the second direction includes a swipe gesture in the second directionthat is opposite the first direction.
 29. The electronic device of claim17, wherein determining that the one or more first touch inputscorrespond to the system gesture for switching applications includesdetermining that the one or more first touch inputs correspond to afirst type of system gesture for switching applications, and the one ormore programs include instructions for: in response to detecting the oneor more first touch inputs: in accordance with a determination that theone or more first touch inputs correspond to a second type of systemgesture for switching applications, replacing display of at least aportion of the user interface of the first software application with auser interface of an operating system without delivering informationcorresponding to the one or more first touch inputs to the firstsoftware application, wherein the operating system is different from thefirst software application and from the second software application. 30.The electronic device of claim 29, wherein: determining that the one ormore first touch inputs correspond to the first type of system gesturefor switching applications includes determining that the one or morefirst touch inputs include a swipe gesture in a first direction; anddetermining that the one or more first touch inputs correspond to thesecond type of system gesture for switching applications includesdetermining that the one or more first touch inputs include a swipegesture in a second direction that is perpendicular to the firstdirection.
 31. The electronic device of claim 29, wherein: determiningthat the one or more first touch inputs correspond to the first type ofsystem gesture for switching applications includes determining that theone or more first touch inputs include a swipe gesture; and determiningthat the one or more first touch inputs correspond to the second type ofsystem gesture for switching applications includes determining that theone or more first touch inputs include a pinch gesture.
 32. Theelectronic device of claim 17, wherein: in accordance with adetermination that the electronic device is operating in a first mode:determining that the one or more first touch inputs correspond to thesystem gesture for switching applications includes determining that theone or more first touch inputs match a first gesture definition for thesystem gesture for switching applications; and in accordance with adetermination that the electronic device is operating in a second mode:determining that the one or more first touch inputs correspond to thesystem gesture for switching applications includes determining that theone or more first touch inputs match a second gesture definition for thesystem gesture for switching applications, wherein the second gesturedefinition is different from the first gesture definition.
 33. Anon-transitory computer readable storage medium storing one or moreprograms, the one or more programs comprising instructions that, whenexecuted by an electronic device with a touch-sensitive display, causethe electronic device to: display, on the touch-sensitive display, auser interface of a first software application; while displaying theuser interface of the first software application, detect one or morefirst touch inputs on a region of the touch-sensitive display thatincludes the user interface of the first software application; and inresponse to detecting the one or more first touch inputs: in accordancewith a determination that the one or more first touch inputs correspondto a system gesture for switching applications, replace display of theuser interface of the first software application with display of a userinterface of a second software application without deliveringinformation corresponding to the one or more first touch inputs to thefirst software application, wherein the second software application isdifferent from the first software application; and in accordance with adetermination that the one or more first touch inputs do not correspondto a system gesture, deliver the information corresponding to the one ormore first touch inputs to the first software application.
 34. Thenon-transitory computer readable storage medium of claim 33, wherein, inaccordance with the determination that the one or more first touchinputs do not correspond to a system gesture, the first softwareapplication performs an operation in response to the informationcorresponding to the one or more first touch inputs being delivered tothe first software application.
 35. The non-transitory computer readablestorage medium of claim 34, wherein the one or more programs includeinstructions that, when executed by the electronic device, cause theelectronic device to process the one or more first touch inputs usingone or more gesture recognizers of the first software application andone or more system gesture recognizers to determine whether the one ormore first touch inputs correspond to the system gesture for switchingapplications.
 36. The non-transitory computer readable storage medium ofclaim 33, wherein the one or more programs include instructions that,when executed by the electronic device, cause the electronic device toprocess the one or more first touch inputs using one or more systemgesture recognizers to determine whether the one or more first touchinputs correspond to the system gesture for switching applications. 37.The non-transitory computer readable storage medium of claim 36, whereinthe one or more system gesture recognizers are associated with anoperating system that is different from the first software application.38. The non-transitory computer readable storage medium of claim 33,wherein the one or more programs include instructions that, whenexecuted by the electronic device, cause the electronic device to, priorto detecting the one or more first touch inputs, display the userinterface of the first software application without concurrentlydisplaying the user interface of the second software application. 39.The non-transitory computer readable storage medium of claim 33, whereinreplacing display of the user interface of the first softwareapplication with display of the user interface of the second softwareapplication includes ceasing to display the user interface of the firstsoftware application.
 40. The non-transitory computer readable storagemedium of claim 33, wherein the second software application is a nextsoftware application following the first software application in asequence of applications with retained state information.
 41. Thenon-transitory computer readable storage medium of claim 33, wherein theone or more programs include instructions that, when executed by theelectronic device, cause the electronic device to: while displaying theuser interface of the second software application, detect one or moresecond touch inputs on a region of the touch-sensitive display thatincludes the user interface of the second software application; and inresponse to detecting the one or more second touch inputs: in accordancewith a determination that the one or more second touch inputs correspondto the system gesture for switching applications, replace display of theuser interface of the second software application with display of a userinterface of a third software application without delivering informationcorresponding to the one or more second touch inputs to the secondsoftware application; and in accordance with a determination that theone or more second touch inputs do not correspond to a system gesture,deliver the information corresponding to the one or more second touchinputs to the second software application.
 42. The non-transitorycomputer readable storage medium of claim 41, wherein the secondsoftware application is a next software application following the firstsoftware application in a sequence of applications with retained stateinformation, and the third software application is a next softwareapplication following the second software application in the sequence ofapplications with retained state information.
 43. The non-transitorycomputer readable storage medium of claim 41, wherein determining thatthe one or more first touch inputs correspond to the system gesture forswitching applications includes determining that the one or more firsttouch inputs correspond to the system gesture for switching applicationsperformed in a first direction, and wherein: in accordance with adetermination that the one or more second touch inputs correspond to thesystem gesture for switching applications performed in the firstdirection, the third software application is different from the firstsoftware application; and in accordance with a determination that theone or more second touch inputs correspond to the system gesture forswitching applications performed in a second direction that is oppositethe first direction, the third software application is the firstsoftware application.
 44. The non-transitory computer readable storagemedium of claim 43, wherein: the system gesture for switchingapplications performed in the first direction includes a swipe gesturein the first direction; and the system gesture for switchingapplications performed in the second direction includes a swipe gesturein the second direction that is opposite the first direction.
 45. Thenon-transitory computer readable storage medium of claim 33, whereindetermining that the one or more first touch inputs correspond to thesystem gesture for switching applications includes determining that theone or more first touch inputs correspond to a first type of systemgesture for switching applications, and the one or more programs includeinstructions that, when executed by the electronic device, cause theelectronic device to: in response to detecting the one or more firsttouch inputs: in accordance with a determination that the one or morefirst touch inputs correspond to a second type of system gesture forswitching applications, replace display of at least a portion of theuser interface of the first software application with a user interfaceof an operating system without delivering information corresponding tothe one or more first touch inputs to the first software application,wherein the operating system is different from the first softwareapplication and from the second software application.
 46. Thenon-transitory computer readable storage medium of claim 45, wherein:determining that the one or more first touch inputs correspond to thefirst type of system gesture for switching applications includesdetermining that the one or more first touch inputs include a swipegesture in a first direction; and determining that the one or more firsttouch inputs correspond to the second type of system gesture forswitching applications includes determining that the one or more firsttouch inputs include a swipe gesture in a second direction that isperpendicular to the first direction.
 47. The non-transitory computerreadable storage medium of claim 45, wherein: determining that the oneor more first touch inputs correspond to the first type of systemgesture for switching applications includes determining that the one ormore first touch inputs include a swipe gesture; and determining thatthe one or more first touch inputs correspond to the second type ofsystem gesture for switching applications includes determining that theone or more first touch inputs include a pinch gesture.
 48. Thenon-transitory computer readable storage medium of claim 33, wherein: inaccordance with a determination that the electronic device is operatingin a first mode: determining that the one or more first touch inputscorrespond to the system gesture for switching applications includesdetermining that the one or more first touch inputs match a firstgesture definition for the system gesture for switching applications;and in accordance with a determination that the electronic device isoperating in a second mode: determining that the one or more first touchinputs correspond to the system gesture for switching applicationsincludes determining that the one or more first touch inputs match asecond gesture definition for the system gesture for switchingapplications, wherein the second gesture definition is different fromthe first gesture definition.